helm 本地仓库及图形化 kubeapps
1,创建本地repo仓库
- 创建镜像目录
创建helm仓库目录:
mkdir -p /opt/nfs/helm-repo
- 启动仓库监听
nohup helm serve --address 0.0.0.0:8879 --repo-path /opt/nfs/helm-repo &
- 向仓库添加package包
可以从github上下载别人已经写好的:https://github.com/kubernetes/charts
cp -r mongodb /opt/nfs/helm-repo
cd /opt/nfs/helm-repo
helm package mongodb --save=false --dependency-update
rm -rf mongod
更新index文件
cd /opt/nfs/helm-repo
helm repo index --url=http://10.10.2.127:8879 .
helm repo update
- 添加验证
此时便可以在将仓库添加到相关helm中
[root@node1 ~]# helm repo add local-127 http://10.10.2.127:8879
"local-127" has been added to your repositories
[root@node1 ~]# helm repo list
NAME URL
bitnami https://charts.bitnami.com/bitnami
stable https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
local-127 http://10.10.2.127:8879
[root@node1 ~]# helm search local-127/mongodb
NAME CHART VERSION APP VERSION DESCRIPTION
local-127/mongodb 5.0.1 4.0.3 NoSQL document-oriented database that stores JSON-like do...
2,安装kubeapps
- 添加需要的repo仓库地址并安装
helm repo add bitnami https://charts.bitnami.com/bitnami
helm install --name kubeapps --namespace kubeapps bitnami/kubeapps
- 登陆验证
创建需要的serviceaccount,并做相关binding
kubectl create serviceaccount kubeapps-operator
kubectl create clusterrolebinding kubeapps-operator --clusterrole=cluster-admin --serviceaccount=default:kubeapps-operator
获取token,用户登陆
[root@node1 ~]# kubectl get secret $(kubectl get serviceaccount kubeapps-operator -o jsonpath='{.secrets[].name}') -o jsonpath='{.data.token}' | base64 --decode
eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZWZhdWx0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6Imt1YmVhcHBzLW9wZXJhdG9yLXRva2VuLWprdDV6Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6Imt1YmVhcHBzLW9wZXJhdG9yIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiOWUwZTg3MzAtMGY1Ni0xMWU5LTgxZmEtMDY5ODNlMDAwMDgxIiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50OmRlZmF1bHQ6a3ViZWFwcHMtb3BlcmF0b3IifQ.GNx7DpbLc5ds05vKorIVMBluk13cx2AyI9N07l_EKwNudUyPcH5RH5O2-MHweokdEZA-3FVgTpYV2hH3CsdsWA2bR2hOcGh7pkRAxRC04KTk_VVKe7NcSifksdaADm6BRxEjtcY54Yjt6avS6uiUxcVcxc6kiNPuREz3RBt53GpPkqR-efXSaDNhJqYaivWHjL6j4dcXblLhEL55aoBCggmcrRJgvisnmNPmHT-R3LweB2TbgVbAq-lb2I4XRCAP2meJGJb0-1SmdC_k4oxKxa3TIi1nG7W0j0qkdN1Gmjp03Tgr7CwvI6dvSMEhq2EfOXV9OmNBwO1p5-i5fiQaVw
将获取的token用户登陆
- 添加本地仓库
点进local-127,便可以看到我们的mongodb chart
- UI安装helm chart
修改名称和values文件,submit提交便可执行安装
点击首页,指定命名空间,可以看到安装的release
备注:在日常维护中我们一般直接使用helm操作。