- https://docs.rancher.cn/download/helm/helm-v3.0.3-linux-amd64.tar.gz
mv linux-amd64/helm /usr/local/bin/">下载Helm
wget https://docs.rancher.cn/download/helm/helm-v3.0.3-linux-amd64.tar.gz
mv linux-amd64/helm /usr/local/bin/ - https://kubernetes-charts.storage.googleapis.com/
# 查找mariadb
helm search repo mariadb
# 安装mariadb主从
helm install mariadb —set “master.persistence.enabled=false”,”slave.persistence.enabled=false” stable/mariadb
# 查看已部署的release列表
helm ls
# 测试部署的应用
# 获取mysql连接密码
ROOT_PASSWORD=$(kubectl get secret —namespace default mariadb -o jsonpath=”{.data.mariadb-root-password}” | base64 —decode)">查看helm版本
helm version
# 添加Helm Chart Repository
helm repo add stable https://kubernetes-charts.storage.googleapis.com/
# 查找mariadb
helm search repo mariadb
# 安装mariadb主从
helm install mariadb —set “master.persistence.enabled=false”,”slave.persistence.enabled=false” stable/mariadb
# 查看已部署的release列表
helm ls
# 测试部署的应用
# 获取mysql连接密码
ROOT_PASSWORD=$(kubectl get secret —namespace default mariadb -o jsonpath=”{.data.mariadb-root-password}” | base64 —decode) - 连接进slave
kubectl exec -it mariadb-slave-0 bash
执行
mysql -u root -pxxxx ///xxx为密码
查看主从连接关系 - 使用helm升级应用
helm upgrade mariadb stable/mariadb —set “slave.replicas=2”,”master.persistence.enabled=false”,”slave.persistence.enabled=false”
更新slave数为2,检查
kubectl get pod - 查看release的历史纪录
helm history mariadb - helm 回滚
helm rollback mariadb - 卸载release
helm uninstall mariadb
下载Helm
wget https://docs.rancher.cn/download/helm/helm-v3.0.3-linux-amd64.tar.gz
mv linux-amd64/helm /usr/local/bin/
查看helm版本
helm version
# 添加Helm Chart Repository
helm repo add stable https://kubernetes-charts.storage.googleapis.com/
# 查找mariadb
helm search repo mariadb
# 安装mariadb主从
helm install mariadb —set “master.persistence.enabled=false”,”slave.persistence.enabled=false” stable/mariadb
# 查看已部署的release列表
helm ls
# 测试部署的应用
# 获取mysql连接密码
ROOT_PASSWORD=$(kubectl get secret —namespace default mariadb -o jsonpath=”{.data.mariadb-root-password}” | base64 —decode)
echo $ROOT_PASSWORD
连接进slave
kubectl exec -it mariadb-slave-0 bash
执行
mysql -u root -pxxxx ///xxx为密码
查看主从连接关系
show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: mariadb
Master_User: replicator
Master_Port: 3306
Connect_Retry: 10
Master_Log_File: mysql-bin.000002
Read_Master_Log_Pos: 342
Relay_Log_File: mysql-relay-bin.000004
Relay_Log_Pos: 641
Relay_Master_Log_File: mysql-bin.000002
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
使用helm升级应用
helm upgrade mariadb stable/mariadb —set “slave.replicas=2”,”master.persistence.enabled=false”,”slave.persistence.enabled=false”
更新slave数为2,检查
kubectl get pod
NAME READY STATUS RESTARTS AGE mariadb-master-0 1/1 Running 0 14m mariadb-slave-0 1/1 Running 0 14m mariadb-slave-1 1/1 Running 8 14m