容器应用,  系统运维

helm 安装k8s应用

1、使用添加到本地的repo 安装 应用

搜索可以安装的wrodpress chart

[root@192-168-28-158 Tools]# helm search repo wordpre
NAME                CHART VERSION   APP VERSION DESCRIPTION                                       
stable/wordpress    9.0.3           5.3.2       DEPRECATED Web publishing platform for building...

开始安装

[root@192-168-28-158 Tools]# helm  install test-wordpress stable/wordpress
WARNING: This chart is deprecated
NAME: test-wordpress
LAST DEPLOYED: Wed Apr 14 14:26:07 2021
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
This Helm chart is deprecated
.
.
.
[root@192-168-28-158 Tools]# kubectl get svc --namespace default -w test-wordpress
NAME             TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)                      AGE
test-wordpress   LoadBalancer   10.233.16.128   <pending>     80:31357/TCP,443:30368/TCP   2m37s

file

2、自定义chart 安装

可以自定义 values.yaml

[root@192-168-28-158 Tools]# echo '{mariadb.auth.database: user0db, mariadb.auth.username: user0}' > /tmp/values.yaml
[root@192-168-28-158 Tools]# helm install -f /tmp/values.yaml wordpress-test -n test stable/wordpress

3、更多安装方法

- chart 的仓库(如上所述)
- 本地 chart 压缩包(helm install foo foo-0.1.1.tgz)
- 解压后的 chart 目录(helm install foo path/to/foo)
- 完整的 URL(helm install foo https://example.com/charts/foo-1.2.3.tgz)

4、更新chart

echo '{mariadb.auth.username: user1}' >/tmp/values-update.yaml
helm upgrade -f /tmp/values-update.yaml wordpress-test -n test stable/wordpress

file

5、回滚release 版本

假如在一次发布过程中,发生了不符合预期的事情,也很容易通过 helm rollback [RELEASE] [REVISION] 命令回滚到之前的发布版本。

[root@192-168-28-158 Tools]# helm rollback wordpress-test 1 -n test
Rollback was a success! Happy Helming!

file

查看历史版本

helm history wordpress-test -n test

file
更多使用细节参考官方文档:
https://helm.sh/zh/docs/intro/using_helm/

留言

您的电子邮箱地址不会被公开。 必填项已用*标注

闽ICP备20008591号-1