openshift 4.3 helm

本文讲述,如何在openshift 4.3 上演示helm功能

video

  • https://youtu.be/L6ioq_JMOtE
  • https://www.bilibili.com/video/BV1qp4y197yH/

参考资料:

https://docs.openshift.com/container-platform/4.3/cli_reference/helm_cli/getting-started-with-helm-on-openshift-container-platform.html

https://chartmuseum.com/docs/#installing-chartsinto-kubernetes

https://whmzsu.github.io/helm-doc-zh-cn/chart/chart_repository-zh_cn.html

操作步骤

# 环境准备
skopeo copy docker://docker.io/gogs/gogs docker://registry.redhat.ren:5443/docker.io/gogs/gogs

skopeo copy docker://docker.io/chartmuseum/chartmuseum:latest docker://registry.redhat.ren:5443/docker.io/chartmuseum/chartmuseum:latest

skopeo copy docker://docker.io/ananwaresystems/webarchive:1.0 docker://registry.redhat.ren:5443/docker.io/ananwaresystems/webarchive:1.0

skopeo copy docker://docker.io/tomcat:7.0 docker://registry.redhat.ren:5443/docker.io/tomcat:7.0 

# https://github.com/helm/charts/tree/master/stable/chartmuseum

# 运行一个helm chart repository
mkdir -p /data/ocp4/helm/charts

podman run --rm -it \
  -p 18080:8080 \
  -v /data/ocp4/helm/charts:/charts:Z \
  -e DEBUG=true \
  -e STORAGE=local \
  -e STORAGE_LOCAL_ROOTDIR=/charts \
  --privileged \
  registry.redhat.ren:5443/docker.io/chartmuseum/chartmuseum:latest

# 准备 helm 客户端
curl -L https://mirror.openshift.com/pub/openshift-v4/clients/helm/latest/helm-linux-amd64 -o /usr/local/bin/helm

chmod +x /usr/local/bin/helm

helm version

helm repo add chartmuseum http://localhost:18080
helm repo list

# 编译一个helm chart, 并上传 chart repository
cd /data/ocp4/helm/tomcat
helm lint
helm package .
curl --data-binary "@tomcat-0.4.1.tgz" http://localhost:18080/api/charts
helm repo update
helm search repo

# 通过 helm chart 创建 tomcat deploy
oc project demo
helm install example-tomcat chartmuseum/tomcat
helm list

# 恢复环境
helm uninstall example-tomcat
helm repo remove chartmuseum

/bin/rm -f /data/ocp4/helm/charts/*