k8s软化管理包 helm

helm安装和使用

二进制安装
#根据操作系统去获取最新二进制安装包https://github.com/helm/helm/releases       
wget https://get.helm.sh/helm-v3.3.1-linux-amd64.tar.gz       
#由于helm包在国外,我通过ss拉到了腾讯云cos,国内可通过以下地址访问:https://download.osichina.net/tools/k8s/helm/helm-v3.3.1-linux-amd64.tar.gz       
tar -zxvf helm-v3.3.1-linux-amd64.tar.gz       
cp linux-amd64/helm /usr/local/bin/

添加helm 仓库

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 add stable http://mirror.azure.cn/kubernetes/charts       
helm repo add aliyun https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts       
helm repo update    
helm repo list

添加自动补齐

echo "source <(helm completion bash)" >>  ~/.bash_profile
source ~/.bash_profile

 

测试helm 安装软件

helm search repo nginx  #查看软件包
kubectl create ns helm-test  #创建命名空间
helm install nginx bitnami/nginx  -n helm-test  #安装软件包
helm list -A    #查看已安装在k8s上的软件包
helm uninstall nginx -n helm-test #卸载软件包

#拉取到本地       
helm pull bitnami/nginx --untar       
#根据values.yml配置本地安装       
helm install nginx . -f values.yaml -n nginx       
#根据values.yml配置本地升级       
helm upgrade nginx . -f values.yaml -n nginx 

自定义拉取本地镜像仓库

helm install my-redis stable/redis   --set image.registry=private.yd-data.com  --set image.repository=public/redis   -n helm-test

## --set image.registry=<自定义镜像仓库地址>
## --set image.repository=<自定义镜像仓库路径>


##如果私有长裤需要认证,创建 ImagePullSecret
kubectl create secret docker-registry my-registry-secret \
  --docker-server=my-registry.example.com \
  --docker-username=admin \
  --docker-password=password \
  -n helm-test

# 在安装Chart时引用Secret
helm install my-redis bitnami/redis \
  --set imagePullSecrets[0].name=my-registry-secret \
  -n helm-test

 

posted @ 2025-06-17 11:14  追梦$少年  阅读(18)  评论(0)    收藏  举报