Helm3
Helm基础 姐妹篇这个是helm2, 现在直接看本文 helm3
目录
helm3
helm [helm] v.掌(舵);掌握;给…戴上头盔
ins
wget -c https://get.helm.sh/helm-v3.9.3-linux-amd64.tar.gz tar xvf helm-v3.9.3-linux-amd64.tar.gz sudo mv linux-amd64/helm /usr/local/bin/helm wget -c https://get.helm.sh/helm-v3.0.3-linux-amd64.tar.gz tar xvf helm-v3.0.3-linux-amd64.tar.gz sudo mv linux-amd64/helm /usr/local/bin/helm 果想要更舒服一些,那么可以添加自动完成的代码: # source <(helm completion bash)
添加 Chart 仓库
在 Helm 3.0 版本中,默认是不会添加 Chart 仓库,所以这里我们需要手动添加,下面是添加一些常用的 Charts 库,命令如下: $ helm repo add elastic https://helm.elastic.co $ helm repo add gitlab https://charts.gitlab.io $ helm repo add harbor https://helm.goharbor.io $ helm repo add bitnami https://charts.bitnami.com/bitnami $ helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com $ helm repo add stable https://kubernetes-charts.storage.googleapis.com 增加完仓库后,需要执行更新命令,将仓库中的信息进行同步: $ helm repo update 注意:如果有的仓库不能正常解析,请更换 DNS 地址,在测试过程中,发现有的能正常解析,有的不能。如果还不行,就直接将域名和对应的地址写死在 Host 文件中
Helm 的基本操作
安装应用
通过 Helm 在 Repo 中查询可安装的 nginx
helm search repo nginx NAME CHART VERSION APP VERSION DESCRIPTION aliyun/nginx-ingress 0.9.5 0.10.2 An nginx Ingress controller that uses ConfigMap... aliyun/nginx-lego 0.3.1 Chart for nginx-ingress-controller and kube-lego apphub/nginx 5.1.5 1.16.1 Chart for the nginx server apphub/nginx-ingress 1.30.3 0.28.0 An nginx Ingress controller that uses ConfigMap... apphub/nginx-ingress-controller 5.3.4 0.29.0 Chart for the nginx Ingress controller apphub/nginx-lego 0.3.1 Chart for nginx-ingress-controller and kube-lego apphub/nginx-php 1.0.0 nginx-1.10.3_php-7.0 Chart for the nginx php server bitnami/nginx 5.1.7 1.16.1 Chart for the nginx server helm search repo redis NAME CHART VERSION APP VERSION DESCRIPTION aliyun/redis 1.1.15 4.0.8 Open source, advanced key-value store. It is of... aliyun/redis-ha 2.0.1 Highly available Redis cluster with multiple se...
安装测试:
–namespace:指定安装的 Namespace
helm install nginx bitnami/nginx -n mydlqcloud
查看应用状态
helm status nginx -n mydlqcloud
ins mysql
参考官方 https://helm.sh/docs/intro/quickstart/
helm repo add stable https://kubernetes-charts.storage.googleapis.com/ $ helm repo update # Make sure we get the latest list of charts $ helm install stable/mysql --generate-name NAME: mysql-1583911857 LAST DEPLOYED: Wed Mar 11 15:31:01 2020 NAMESPACE: default STATUS: deployed REVISION: 1 NOTES: MySQL can be accessed via port 3306 on the following DNS name from within your cluster: mysql-1583911857.default.svc.cluster.local To get your root password run: MYSQL_ROOT_PASSWORD=$(kubectl get secret --namespace default mysql-1583911857 -o jsonpath="{.data.mysql-root-password}" | base64 --decode; echo) To connect to your database: 1. Run an Ubuntu pod that you can use as a client: kubectl run -i --tty ubuntu --image=ubuntu:16.04 --restart=Never -- bash -il 2. Install the mysql client: $ apt-get update && apt-get install mysql-client -y 3. Connect using the mysql cli, then provide your password: $ mysql -h mysql-1583911857 -p To connect to your database directly from outside the K8s cluster: MYSQL_HOST=127.0.0.1 MYSQL_PORT=3306 # Execute the following command to route the connection: kubectl port-forward svc/mysql-1583911857 3306 mysql -h ${MYSQL_HOST} -P${MYSQL_PORT} -u root -p${MYSQL_ROOT_PASSWORD}
see also
renference
https://helm.sh/docs/intro/install/
从入门到实践:创作一个自己的 Helm Chart
k8s (二十二) --- kubernetes Helm详解及使用helm部署redis高可用集群