文章目录
1. 下载
# 添加helm repo
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
[root@master helm]# helm search repo ingress-nginx
NAME CHART VERSION APP VERSION DESCRIPTION
ingress-nginx/ingress-nginx 4.0.18 1.1.2 Ingress controller for Kubernetes using NGINX a...
# 下载并解压缩
[root@master helm]# helm pull ingress-nginx/ingress-nginx
2. 修改value.yaml
cat <<EOF> my-values.yaml
controller:
image:
registry: registry.cn-shanghai.aliyuncs.com
image: wanfei/ingress-nginx-controller
tag: "v1.1.2"
digest:
dnsPolicy: ClusterFirstWithHostNet
hostNetwork: true
publishService: # hostNetwork 模式下设置为false,通过节点IP地址上报ingress status数据
enabled: false
# 是否需要处理不带 ingressClass 注解或者 ingressClassName 属性的 Ingress 对象
# 设置为 true 会在控制器启动参数中新增一个 --watch-ingress-without-class 标注
watchIngressWithoutClass: false
kind: DaemonSet
tolerations: # kubeadm 安装的集群默认情况下master是有污点,需要容忍这个污点才可以部署
- key: "node-role.kubernetes.io/master"
operator: "Equal"
effect: "NoSchedule"
nodeSelector: # 固定到master节点
kubernetes.io/hostname: master
service: # HostNetwork 模式不需要创建service
enabled: false
admissionWebhooks:
patch:
image:
registry: registry.cn-shanghai.aliyuncs.com
image: wanfei/kube-webhook-certgen
tag: v1.1.1
digest:
defaultBackend:
enabled: true
image:
registry: registry.cn-shanghai.aliyuncs.com
image: wanfei/defaultbackend-amd64
tag: "1.5"
EOF
3. 安装
[root@master ingress-nginx]# helm install ingress-nginx --namespace kube-system -f my-values.yaml .
[root@master ingress-nginx]# kubectl get ingressClass
NAME CONTROLLER PARAMETERS AGE
nginx k8s.io/ingress-nginx <none> 90s
4. ingress.yaml示例
cat <<EOF> kiali-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: kiali-ingress
namespace: istio-system
spec:
ingressClassName: nginx # 使用 nginx 的 IngressClass(关联的 ingress-nginx 控制器)
rules:
- host: kiali.tophant.wang
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: kiali
port:
number: 20001
EOF
参考 https://www.modb.pro/db/220046
参考 https://blog.csdn.net/weixin_40046357/article/details/122119644