Helm/MariaDB/PV: Difference between revisions
Jump to navigation
Jump to search
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{|class='wikitable' | |||
|valign='top' style='width:50%'| | |||
<syntaxhighlight lang='bash'> | |||
helm repo add bitnami https://charts.bitnami.com/bitnami | |||
helm repo update && helm repo list | |||
kubectl config get-contexts | |||
</syntaxhighlight> | |||
|valign='top' style='width:50%'| | |||
|} | |||
==Config== | ==Config== | ||
{| | {|class='wikitable mw-collapsible' | ||
|valign= | !scope='col' style='text-align:left' colspan='2'| | ||
<syntaxhighlight lang= | Config | ||
|- | |||
|valign='top' style='width:50%'| | |||
<syntaxhighlight lang='properties'> | |||
export KUBECONFIG="${HOME}/.kube/aws-kubeconfig.yaml" | export KUBECONFIG="${HOME}/.kube/aws-kubeconfig.yaml" | ||
export KUBECONFIG="${HOME}/.kube/dev-kubeconfig.yaml" | export KUBECONFIG="${HOME}/.kube/dev-kubeconfig.yaml" | ||
| Line 13: | Line 23: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|valign= | |valign='top' style='width:50%'| | ||
<syntaxhighlight lang= | <syntaxhighlight lang='bash'> | ||
cat <<'EXE'| sudo bash | cat <<'EXE'| sudo bash | ||
mkdir -p /var/minikube/pvc/mariadb/data-mariadb-0/ | mkdir -p /var/minikube/pvc/mariadb/data-mariadb-0/ | ||
| Line 23: | Line 33: | ||
==Install== | ==Install== | ||
{| | {|class='wikitable mw-collapsible' | ||
|valign= | !scope='col' style='text-align:left' colspan='2'| | ||
<syntaxhighlight lang= | Install | ||
|- | |||
|valign='top' style='width:50%'| | |||
<syntaxhighlight lang='bash'> | |||
kubectl get ns|grep mariadb | kubectl get ns|grep mariadb | ||
kubectl delete ns mariadb | kubectl delete ns mariadb | ||
| Line 33: | Line 46: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|valign= | |valign='top' style='width:50%'| | ||
<syntaxhighlight lang= | <syntaxhighlight lang='properties'> | ||
cat <<ENV | kubectl -n mariadb create secret generic mariadb --from-env-file=/dev/stdin | cat <<ENV | kubectl -n mariadb create secret generic mariadb --from-env-file=/dev/stdin | ||
mariadb-replication-password=sadaqah! | mariadb-replication-password=sadaqah! | ||
| Line 42: | Line 55: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| | |valign='top' colspan='2'| | ||
* [[K8s/Storage#Storage » Mount|Skipped » Find More 👉 Storage » Mount]] | * [[K8s/Storage#Storage » Mount|Skipped » Find More 👉 Storage » Mount]] | ||
|- | |- | ||
| | |valign='top' colspan='2'| | ||
* [[K8s/Storage#Storage » Class » Hostpath|Skipped » Find More 👉 Storage » Class » Hostpath]] | * [[K8s/Storage#Storage » Class » Hostpath|Skipped » Find More 👉 Storage » Class » Hostpath]] | ||
|- | |- | ||
| | |valign='top' colspan='2'| | ||
* [[K8s/Storage#Storage » Persistent Volume|Skipped » Find More 👉 Storage » Persistent Volume]] | * [[K8s/Storage#Storage » Persistent Volume|Skipped » Find More 👉 Storage » Persistent Volume]] | ||
|- | |- | ||
|valign="top"| | |valign="top"| | ||
| Line 109: | Line 109: | ||
|- | |- | ||
| | |valign='top' colspan='2'| | ||
<syntaxhighlight lang="yaml"> | <syntaxhighlight lang="yaml"> | ||
cat <<YML | helm -n mariadb install mariadb bitnami/mariadb --version=19.0.5 -f - | cat <<YML | helm -n mariadb install mariadb bitnami/mariadb --version=19.0.5 -f - | ||
| Line 153: | Line 150: | ||
|- | |- | ||
| | |valign='top' colspan='2'| | ||
* [[Minikube MetalLB#MetalLB » Forward » Route|Skipped » Find More 👉 MetalLB » Forward » Route]] | * [[Minikube MetalLB#MetalLB » Forward » Route|Skipped » Find More 👉 MetalLB » Forward » Route]] | ||
|- | |- | ||
|valign='top'| | |valign='top'| | ||
<syntaxhighlight lang= | <syntaxhighlight lang='bash'> | ||
echo -n password: ;read -s MYSQL_PWD;export MYSQL_PWD;echo | echo -n password: ;read -s MYSQL_PWD;export MYSQL_PWD;echo | ||
mariadb -h192.168.49.101 -P3306 -uacademia academia | mariadb -h192.168.49.101 -P3306 -uacademia academia | ||
| Line 171: | Line 162: | ||
|valign='top'| | |valign='top'| | ||
<syntaxhighlight lang= | <syntaxhighlight lang='bash'> | ||
echo -n password: ;read -s MYSQL_PWD;export MYSQL_PWD;echo | echo -n password: ;read -s MYSQL_PWD;export MYSQL_PWD;echo | ||
mariadb 'mariadb://root@192.168.49.101:3306/academia' | mariadb 'mariadb://root@192.168.49.101:3306/academia' | ||
| Line 180: | Line 171: | ||
==Uninstall== | ==Uninstall== | ||
<syntaxhighlight lang= | {|class='wikitable mw-collapsible' | ||
!scope='col' style='text-align:left' colspan='2'| | |||
Uninstall | |||
|- | |||
|valign='top' style='width:50%'| | |||
<syntaxhighlight lang='bash'> | |||
kubectl delete namespace mariadb | kubectl delete namespace mariadb | ||
helm uninstall -n mariadb mariadb | helm uninstall -n mariadb mariadb | ||
kubectl -n mariadb delete pvc --all | |||
kubectl delete pv mariadb-data-mariadb-0 | kubectl delete pv mariadb-data-mariadb-0 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|valign='top' style='width:50%'| | |||
|} | |||
==Swiss Knife== | ==Swiss Knife== | ||
{|class='wikitable mw-collapsible' | |||
!scope='col' style='text-align:left' colspan='2'| | |||
Swiss Knife | |||
|- | |||
|valign='top' style='width:50%'| | |||
* [[Helm/MariaDB#Swiss Knife|Skipped » Find More » 👈]] | * [[Helm/MariaDB#Swiss Knife|Skipped » Find More » 👈]] | ||
|valign='top' style='width:50%'| | |||
|} | |||
==AWS » EKS== | ==AWS » EKS== | ||
{|class='wikitable mw-collapsible' | |||
!scope='col' style='text-align:left' colspan='2'| | |||
AWS » EKS | |||
|- | |||
|valign='top' style='width:50%'| | |||
* [[Helm/MariaDB#AWS » EKS|Skipped » Find More » 👈]] | * [[Helm/MariaDB#AWS » EKS|Skipped » Find More » 👈]] | ||
|valign='top' style='width:50%'| | |||
|} | |||
==Playground== | ==Playground== | ||
{| | {|class='wikitable mw-collapsible' | ||
| colspan= | !scope='col' style='text-align:left' colspan='2'| | ||
<syntaxhighlight lang= | Playground | ||
|- | |||
|valign='top' colspan='2'| | |||
<syntaxhighlight lang='bash'> | |||
helm -n mariadb install mariadb bitnami/mariadb --version=19.0.0 | helm -n mariadb install mariadb bitnami/mariadb --version=19.0.0 | ||
helm -n mariadb upgrade -i mariadb bitnami/mariadb --version=19.0.5 | helm -n mariadb upgrade -i mariadb bitnami/mariadb --version=19.0.5 | ||
helm show values bitnami/mariadb --version=19.0.5|less | helm show values bitnami/mariadb --version=19.0.5|less | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| | |valign='top' colspan='2'| | ||
<syntaxhighlight lang='bash'> | |||
<syntaxhighlight lang= | |||
kubectl -n mariadb get secret mariadb -o json|jq -r '.data."mariadb-replication-password"'|base64 -d;echo | kubectl -n mariadb get secret mariadb -o json|jq -r '.data."mariadb-replication-password"'|base64 -d;echo | ||
kubectl -n mariadb get secret mariadb -o json|jq -r '.data."mariadb-root-password"'|base64 -d;echo | kubectl -n mariadb get secret mariadb -o json|jq -r '.data."mariadb-root-password"'|base64 -d;echo | ||
| Line 215: | Line 231: | ||
kubectl -n mariadb exec -it svc/mariadb -- mysql -uroot -p | kubectl -n mariadb exec -it svc/mariadb -- mysql -uroot -p | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| | |valign='top' colspan='2'| | ||
<syntaxhighlight lang='bash'> | |||
<syntaxhighlight lang= | |||
kubectl config --kubeconfig=${HOME}/.kube/aws-kubeconfig.yaml view --flatten | kubectl config --kubeconfig=${HOME}/.kube/aws-kubeconfig.yaml view --flatten | ||
kubectl config --kubeconfig=${HOME}/.kube/dev-kubeconfig.yaml view --flatten | kubectl config --kubeconfig=${HOME}/.kube/dev-kubeconfig.yaml view --flatten | ||
| Line 227: | Line 239: | ||
kubectl config --kubeconfig=${HOME}/.kube/config view --flatten | kubectl config --kubeconfig=${HOME}/.kube/config view --flatten | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| valign= | |valign='top' style='width:50%'| | ||
<syntaxhighlight lang= | <syntaxhighlight lang='bash'> | ||
kubectl -n mariadb delete all --all | kubectl -n mariadb delete all --all | ||
kubectl -n mariadb delete ing --all | kubectl -n mariadb delete ing --all | ||
| Line 239: | Line 247: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| valign= | |valign='top' style='width:50%'| | ||
<syntaxhighlight lang= | <syntaxhighlight lang='bash'> | ||
kubectl delete pv mariadb-data-mariadb-0 | kubectl delete pv mariadb-data-mariadb-0 | ||
kubectl -n mariadb delete svc --all | kubectl -n mariadb delete svc --all | ||
kubectl -n mariadb delete pvc --all | kubectl -n mariadb delete pvc --all | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
|valign='top'| | |||
<syntaxhighlight lang='bash'> | |||
| valign= | |||
<syntaxhighlight lang= | |||
kubectl -n mariadb rollout history sts mariadb | kubectl -n mariadb rollout history sts mariadb | ||
kubectl -n mariadb rollout restart sts mariadb | kubectl -n mariadb rollout restart sts mariadb | ||
| Line 257: | Line 261: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| valign= | |valign='top'| | ||
<syntaxhighlight lang= | <syntaxhighlight lang='bash'> | ||
kubectl -n mariadb exec -it mariadb-0 -- mariadb -uroot -p | kubectl -n mariadb exec -it mariadb-0 -- mariadb -uroot -p | ||
kubectl -n mariadb logs -f svc/mariadb -c mariadb | kubectl -n mariadb logs -f svc/mariadb -c mariadb | ||
| Line 267: | Line 271: | ||
==References== | ==References== | ||
{| | {|class='wikitable mw-collapsible' | ||
| valign= | !scope='col' style='text-align:left' colspan='3'| | ||
References | |||
|- | |||
|valign='top' style='width:33%'| | |||
* [[Helm/Prometheus Stack|Helm » Prometheus Stack]] | * [[Helm/Prometheus Stack|Helm » Prometheus Stack]] | ||
* [[Helm/PostgreSQL/PV|Helm » PostgreSQL » PV]] | * [[Helm/PostgreSQL/PV|Helm » PostgreSQL » PV]] | ||
| Line 278: | Line 285: | ||
* [[Helm]] | * [[Helm]] | ||
| valign= | |valign='top' style='width:34%'| | ||
|valign='top' style='width:33%'| | |||
|- | |- | ||
|valign='top'| | |||
| valign= | |||
* [https://github.com/bitnami/charts/tree/main/bitnami/mariadb MariaDB » Bitnami » Helm Charts] | * [https://github.com/bitnami/charts/tree/main/bitnami/mariadb MariaDB » Bitnami » Helm Charts] | ||
* [https://bitnami.com/stack/mariadb/helm MariaDB » Bitnami » Package] | * [https://bitnami.com/stack/mariadb/helm MariaDB » Bitnami » Package] | ||
| Line 292: | Line 295: | ||
* [[MySQL|MariaDB]] | * [[MySQL|MariaDB]] | ||
| valign= | |valign='top'| | ||
|valign='top'| | |||
|- | |- | ||
|valign='top'| | |||
| valign= | |||
* [https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ K8s » Configure Service Accounts for Pods] | * [https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ K8s » Configure Service Accounts for Pods] | ||
* [https://spacelift.io/blog/restart-kubernetes-pods-with-kubectl K8s » Restart Pods With Kubectl] | * [https://spacelift.io/blog/restart-kubernetes-pods-with-kubectl K8s » Restart Pods With Kubectl] | ||
| Line 312: | Line 311: | ||
* [[K8s]] | * [[K8s]] | ||
| valign= | |valign='top'| | ||
* [https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/ K8s » <code>kubectl rollout</code>] | * [https://kubernetes.io/docs/reference/kubectl/generated/kubectl_rollout/ K8s » <code>kubectl rollout</code>] | ||
* [[K8s/CSI Hostpath Driver|K8s » CSI Hostpath Driver]] | * [[K8s/CSI Hostpath Driver|K8s » CSI Hostpath Driver]] | ||
| Line 324: | Line 323: | ||
* [[UFW]] | * [[UFW]] | ||
| valign= | |valign='top'| | ||
* [[Security/Password|Security » Password]] | |||
|} | |} | ||
Latest revision as of 21:02, 19 January 2026
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update && helm repo list
kubectl config get-contexts
|
Config
|
Config | |
|---|---|
export KUBECONFIG="${HOME}/.kube/aws-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/dev-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/gcp-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/config"
|
cat <<'EXE'| sudo bash
mkdir -p /var/minikube/pvc/mariadb/data-mariadb-0/
chown -R 1001:1001 /var/minikube/pvc/mariadb/
EXE
|
Install
|
Install | |
|---|---|
kubectl get ns|grep mariadb
kubectl delete ns mariadb
kubectl get ns|grep mariadb
kubectl create ns mariadb
|
cat <<ENV | kubectl -n mariadb create secret generic mariadb --from-env-file=/dev/stdin
mariadb-replication-password=sadaqah!
mariadb-root-password=sadaqah!
mariadb-password=sadaqah!
ENV
|
cat <<'YML'| kubectl apply -f -
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: mariadb-data-mariadb-0
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: hostpath
hostPath:
path: /var/hostpath_pv/mariadb/data-mariadb-0
type: DirectoryOrCreate
YML
|
cat << YML | kubectl apply -f -
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app.kubernetes.io/name: mariadb
name: data-mariadb-0
namespace: mariadb
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: hostpath
volumeName: mariadb-data-mariadb-0
YML
|
cat <<YML | helm -n mariadb install mariadb bitnami/mariadb --version=19.0.5 -f -
---
global:
defaultStorageClass: hostpath
architecture: standalone
auth:
database: academia
username: academia
existingSecret: mariadb
primary:
service:
type: LoadBalancer
loadBalancerIP: 192.168.49.101
persistence:
size: 10Gi
storageClass: hostpath
existingClaim: data-mariadb-0
initdbScripts:
init-chorke.sql: |
-- create database
CREATE DATABASE IF NOT EXISTS academia_flair_staging;
CREATE DATABASE IF NOT EXISTS academia_audit_staging;
CREATE DATABASE IF NOT EXISTS academia_quote_staging;
CREATE DATABASE IF NOT EXISTS academia_users_staging;
CREATE DATABASE IF NOT EXISTS chorke;
-- create user
CREATE USER 'chorke'@'%' IDENTIFIED BY 'sadaqah!';
-- grant access
GRANT ALL PRIVILEGES ON academia_flair_staging.* TO 'chorke'@'%';
GRANT ALL PRIVILEGES ON academia_audit_staging.* TO 'chorke'@'%';
GRANT ALL PRIVILEGES ON academia_quote_staging.* TO 'chorke'@'%';
GRANT ALL PRIVILEGES ON academia_users_staging.* TO 'chorke'@'%';
GRANT ALL PRIVILEGES ON chorke.* TO 'chorke'@'%';
YML
| |
echo -n password: ;read -s MYSQL_PWD;export MYSQL_PWD;echo
mariadb -h192.168.49.101 -P3306 -uacademia academia
mariadb -h192.168.49.101 -P3306 -uroot mysql
|
echo -n password: ;read -s MYSQL_PWD;export MYSQL_PWD;echo
mariadb 'mariadb://root@192.168.49.101:3306/academia'
mariadb 'mariadb://root@192.168.49.101:3306/mysql'
|
Uninstall
|
Uninstall | |
|---|---|
kubectl delete namespace mariadb
helm uninstall -n mariadb mariadb
kubectl -n mariadb delete pvc --all
kubectl delete pv mariadb-data-mariadb-0
|
|
Swiss Knife
|
Swiss Knife | |
|---|---|
AWS » EKS
|
AWS » EKS | |
|---|---|
Playground
|
Playground | |
|---|---|
helm -n mariadb install mariadb bitnami/mariadb --version=19.0.0
helm -n mariadb upgrade -i mariadb bitnami/mariadb --version=19.0.5
helm show values bitnami/mariadb --version=19.0.5|less
| |
kubectl -n mariadb get secret mariadb -o json|jq -r '.data."mariadb-replication-password"'|base64 -d;echo
kubectl -n mariadb get secret mariadb -o json|jq -r '.data."mariadb-root-password"'|base64 -d;echo
kubectl -n mariadb get secret mariadb -o json|jq -r '.data."mariadb-password"'|base64 -d;echo
kubectl -n mariadb exec -it svc/mariadb -c mariadb -- mariadb -uacademia academia -p
kubectl -n mariadb exec -it svc/mariadb -c mariadb -- bash
kubectl -n mariadb exec -it svc/mariadb -- mysql -uroot -p
| |
kubectl config --kubeconfig=${HOME}/.kube/aws-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/dev-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/gcp-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/config view --flatten
| |
kubectl -n mariadb delete all --all
kubectl -n mariadb delete ing --all
kubectl -n mariadb delete sts --all
|
kubectl delete pv mariadb-data-mariadb-0
kubectl -n mariadb delete svc --all
kubectl -n mariadb delete pvc --all
|
kubectl -n mariadb rollout history sts mariadb
kubectl -n mariadb rollout restart sts mariadb
kubectl -n mariadb rollout status sts mariadb
|
kubectl -n mariadb exec -it mariadb-0 -- mariadb -uroot -p
kubectl -n mariadb logs -f svc/mariadb -c mariadb
kubectl -n mariadb logs -f svc/mariadb
|
References
|
References | ||
|---|---|---|