helm3.0部署nginx-ingress

1.下载二进制包 helm-v3.0.1-linux-amd64.tar.gz 
下载地址:https://github.com/helm/helm/releases

2.安装helm到本地

tar -xf helm-v3.0.1-linux-amd64.tar.gz 
mv linux-amd64 helm
cd helm
ls
cp helm /usr/local/bin
sudo cp helm /usr/local/bin


3.检验helm是否安装成功
输入命令:

helm version



返回:

version.BuildInfo{Version:"v3.0.1", GitCommit:"7c22ef9ce89e0ebeb7125ba2ebf7d421f3e82ffa", GitTreeState:"clean", GoVersion:"go1.13.4"}



由于helm3.0重构,区别于helm2.x版本已经不需要安装tiller

4.添加国内源仓库:

helm repo add repo_name1 https://aliacs-app-catalog.oss-cn-hangzhou.aliyuncs.com/charts-incubator 
helm repo add gitlab https://charts.gitlab.io/
helm repo add aliyun https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/
helm repo remove stable && helm repo add stable https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
helm repo update


5.安装ingress
(1)从仓库下载charts

helm pull stable/nginx-ingress


(2) 解压charts

 tar -xf nginx-ingress-0.9.5.tgz


(3) 查看nginx-ingress目录

helm3.0部署nginx-ingress_第1张图片

4)在nginx-ingress父目录执行安装ingress命令

 

## 第一个 nginx-ingress 是 release 名。第二个 nginx-ingress 是 chart 解压目录。

helm install nginx-ingress nginx-ingress -n kube-system

出现报错信息:

 

Error: unable to build kubernetes objects from release manifest: unable to recognize "": no matches for kind "Deployment" in version "extensions/v1beta1"

 

解决方案:

将nginx-ingress文件夹的deployment文件apiVersion修改为apps/v1

执行命令如下:

 

grep -irl "extensions/v1beta1" nginx-ingress | grep deploy | xargs sed -i 's#extensions/v1beta1#apps/v1#g'

出现报错信息:

Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: ValidationError(Deployment.spec): missing required field "selector" in io.k8s.api.apps.v1.DeploymentSpec

 

解决方案:

由于k8s1.16版本升级,需要Deployment.spec中加selector,所以愉快地加上就行了。

 

执行命令如下:

 

vi nginx-ingress/templates/controller-deployment.yaml

添加spec.selector代码块与metadata.labels对应

helm3.0部署nginx-ingress_第2张图片

 

vi nginx-ingress/templates/default-backend-deployment.yaml

同上处理

helm3.0部署nginx-ingress_第3张图片

 

重新执行部署命令:

##先卸载

helm uninstall nginx-ingress nginx-ingress -n kube-system
##再安装

helm install nginx-ingress nginx-ingress -n kube-system

结果如图表示安装成功:

 

helm3.0部署nginx-ingress_第4张图片

你可能感兴趣的:(工具)