rancher集群架构图
Helm部署rancher 高可用集群
Helm简介
Helm是Kubernetes的一个包管理工具,用来简化Kubernetes应用的部署和管理。可以把Helm比作CentOS的yum工具。 Helm有如下几个基本概念:
Chart: 是Helm管理的安装包,里面包含需要部署的安装包资源。可以把Chart比作CentOS yum使用的rpm文件。
Release:是chart的部署实例,一个chart在一个Kubernetes集群上可以有多个release,即这个chart可以被安装多次
Repository:chart的仓库,用于发布和存储chart
下载:https://github.com/helm/helm/releases
查看pods情况
kubectl get pods --namespace=kube-system
kubectl get pods --all-namespaces
如果想删除它,则先找到deployment,再删除它即可
kangming@ubuntu26:~$ kubectl get deployment --namespace=kube-system
NAMEREADY UP-TO-DATE AVAILABLE AGE
calico-kube-controllers 1/1 11 4h23m
coredns 2/2 22 4h22m
coredns-autoscaler1/1 11 4h22m
metrics-server1/1 11 4h18m
tiller-deploy 0/1 10 4h15mkangming@ubuntu26:~$ kubectl delete deployment tiller-deploy --namespace=kube-system
deployment.apps "tiller-deploy" deleted
如果要详细的查看某个pod,则可以describe
kubectl describe pod rke-coredns-addon-deploy-job-qz8v6--namespace=kube-system
helm3安装
最新稳定版本:v3.9.2
下载
https://get.helm.sh/helm-v3.9.2-linux-amd64.tar.gz
安装
tar -zxvf helm-v3.9.2-linux-amd64.tar.gz
sudo mv linux-amd64/helm /usr/local/bin/helm
sudo chmod +x /usr/local/bin/helm
查看官方文档:
Helm | Docs
Helm | 快速入门指南
添加一个chart仓库
helm repo add bitnami https://charts.bitnami.com/bitnami
查看可安装chart列表
kangming@ubuntu26:~/rancher$ helm search repo bitnami
NAMECHART VERSION APP VERSION DESCRIPTION
bitnami/airflow 13.0.22.3.3 Apache Airflow is a tool to express and execute...
bitnami/apache9.1.162.4.54Apache HTTP Server is an open-source HTTP serve...
bitnami/argo-cd 4.0.6 2.4.8 Argo CD is a continuous delivery tool for Kuber...
bitnami/argo-workflows2.3.8 3.3.8 Argo Workflows is meant to orchestrate Kubernet...
安装chart示例
##确定我们可以拿到最新的charts列表
helm repo update#安装一个mysql的chat示例
helm install bitnami/mysql --generate-name
NAME: mysql-1659686641
LAST DEPLOYED: Fri Aug5 16:04:04 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: mysql
CHART VERSION: 9.2.5
APP VERSION: 8.0.30** Please be patient while the chart is being deployed **Tip:Watch the deployment status using the command: kubectl get pods -w --namespace defaultServices:echo Primary: mysql-1659686641.default.svc.cluster.local:3306Execute the following to get the administrator credentials:echo Username: root
MYSQL_ROOT_PASSWORD=$(kubectl get secret --namespace default mysql-1659686641 -o jsonpath="{.data.mysql-root-password}" | base64 -d)To connect to your database:1. Run a pod that you can use as a client:kubectl run mysql-1659686641-client --rm --tty -i --restart='Never' --imagedocker.io/bitnami/mysql:8.0.30-debian-11-r4 --namespace default --env MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD --command -- bash2. To connect to primary ser