k8s使用helm私有仓库的简单配置
环境:K8S已经部署好了HELM,并能正常工作https://blog.csdn.net/lsysafe/article/details/946335811、启动本地repo仓库服务并添加本地repo[root@k8s1 helm]# nohup helm serve --address 192.168.137.71:8879 --repo-path /opt/k8s/helm &am...
环境:K8S已经部署好了HELM,并能正常工作
https://blog.csdn.net/lsysafe/article/details/94633581
1、启动本地repo仓库服务并添加本地repo
[root@k8s1 helm]# nohup helm serve --address 192.168.137.71:8879 --repo-path /opt/k8s/helm &
目录可以先创建好
添加本地repo
[root@k8s1 test]# helm repo add local-repos http://192.168.137.71:8879
"local-repos" has been added to your repositories
[root@k8s1 helm]# helm repo list
NAME URL
stable https://kubernetes-charts.storage.googleapis.com
local-repos http://192.168.137.71:8879
2、创建chart包并添加到本地仓库
[root@k8s1 test2]# helm create t1
Creating t1
[root@k8s1 test2]# cd t1/
[root@k8s1 t1]# ls
charts Chart.yaml templates values.yaml
将values.yaml改成本地docker仓库的镜像,这样快一些
改动的部份
image:
repository: re.bcdgptv.com.cn/http
tag: v2.4
pullPolicy: IfNotPresent
将chart打包
[root@k8s1 test2]# helm package t1
Successfully packaged chart and saved it to: /tmp/test2/t1-0.1.0.tgz
拷到发布的目录中
[root@k8s1 test2]# cp t1-0.1.0.tgz /opt/k8s/helm/
更新index,使新加入的chart包在列表中
[root@k8s1 test2]# cd /opt/k8s/helm/
[root@k8s1 helm]# helm repo index . --url=http://192.168.156.71:8879
效果如下
3、刷新并安装chart
[root@k8s1 helm]# helm search t1
No results found
[root@k8s1 helm]# helm repo list
NAME URL
stable https://kubernetes-charts.storage.googleapis.com
local-repos http://192.168.137.71:8879
[root@k8s1 helm]# helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "local-repos" chart repository
[root@k8s1 helm]# helm search t1
NAME CHART VERSION APP VERSION DESCRIPTION
local-repos/t1 0.1.0 1.0 A Helm chart for Kubernetes
[root@k8s1 helm]# helm install local-repos/t1
NAME: ungaged-iguana
LAST DEPLOYED: Fri Jul 5 19:21:59 2019
NAMESPACE: default
STATUS: DEPLOYED
RESOURCES:
==> v1/Deployment
NAME READY UP-TO-DATE AVAILABLE AGE
ungaged-iguana-t1 0/1 0 0 1s
==> v1/Service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ungaged-iguana-t1 ClusterIP 10.254.126.119 <none> 80/TCP 2s
NOTES:
1. Get the application URL by running these commands:
export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=t1,app.kubernetes.io/instance=ungaged-iguana" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:80
安装成功,pod已经跑起来了
[root@k8s1 helm]# kubectl get all
NAME READY STATUS RESTARTS AGE
pod/ungaged-iguana-t1-5b5bcb677b-9l4gw 1/1 Running 0 22m
pod/yummy-kitten-hello-svc-77c6ff5b55-6kpt9 1/1 Running 0 1d
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.254.0.1 <none> 443/TCP 92d
service/ungaged-iguana-t1 ClusterIP 10.254.126.119 <none> 80/TCP 22m
service/yummy-kitten-hello-svc ClusterIP 10.254.183.143 <none> 80/TCP 1d
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
deployment.apps/ungaged-iguana-t1 1 1 1 1 22m
deployment.apps/yummy-kitten-hello-svc 1 1 1 1 1d
NAME DESIRED CURRENT READY AGE
replicaset.apps/ungaged-iguana-t1-5b5bcb677b 1 1 1 22m
replicaset.apps/yummy-kitten-hello-svc-77c6ff5b55 1 1 1 1d
更多推荐
所有评论(0)