背景
自建K8S集群,版本v1.21.2
有时间推荐看官方文档:https://kubernetes.github.io/ingress-nginx/deploy/
安装
下载YAML文件
wget https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.0.4/deploy/static/provider/cloud/deploy.yaml
使用主机网络
在YAML文件Deployment模块启用hostNetwork
vim deploy.yaml
kind: Deployment
....
spec:
template:
spec:
hostNetwork: true
在指定主机运行
给指定主机打标签
kubectl label node node-1 isIngress="true"
在YAML文件Deployment模块添加nodeSelector项
vim deploy.yaml
kind: Deployment
....
spec:
template:
spec:
nodeSelector:
isIngress: "true"
安装
kubectl apply -f deploy.yaml
网友评论