安装ingress(helm)
1.拉取ingress chart
# 添加仓库资源
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
# 更新仓库
helm repo update
# 检索chart
helm search repo ingress-nginx
# 拉取chart
helm pull ingress-nginx/ingress-nginx
2.编辑values.yaml
# 修改镜像
# 注释掉registry,image,digest,并打开repository
repository: willdockerhub/ingress-nginx-controller
tag: "v1.0.0"
repository: jettech/kube-webhook-certgen
tag: v1.5.2
repository: mirrorgooglecontainers/defaultbackend-amd64
tag: "1.5"
#修改dns策略
dnsPolicy: ClusterFirstWithHostNet
# 使用hostNetwork,即使用宿主机上的端口80 443
hostNetwork: false
# 使用DaemonSet,将ingress部署在指定节点上
kind: DaemonSet
# 节点选择,将需要部署的节点打上ingress=true的label
nodeSelector:
kubernetes.io/os: linux
ingress: "true"
3.安装ingress
# 选择节点打label
kubectl label node node01 ingress=true
# 创建一个ingress的namespace
kubectl create ns ingress-nginx
# 创建ingress
# 如果提示cannot re-use a name that is still in use
# 则先helm uninstall ingress-nginx --namespace ingress-nginx
# 如果安装完成后无法访问其他节点日志,则需要配置hosts,将所有节点配置到hosts中即可
helm install ingress-nginx ingress-nginx -n ingress-nginx
完成后如下图: