Ingress-nginx安装部署
1.部署文件下载
# 下载地址
https://github.com/kubernetes/ingress-nginx/tree/nginx-0.30.0
# configmap.yaml 存储配置信息,key/value值
# namespace.yaml 建命名空间
# mandatory.yaml 包含部署deploy相关所有资源(configmap.yaml,namespace.yaml,rbac.yaml,with-rbac.yaml)
# rbac.yaml rbac授权配置,创建Ingress需要使用的
# ServiceAccount,ClusterRole,Role,RoleBinding,ClusterRoleBinding
# with-rbac.yaml 能使用rbac授权的deploy配置,用于构建ingress-controller
2.service文件下载
# 下载地址
https://github.com/kubernetes/ingress-nginx/tree/nginx-0.30.0
3.修改mandatory.yaml的镜像源
# 将镜像源 quay.io 替换成 quay.azk8s.cn
sed -i 's/quay.io/quay.azk8s.cn/' mandatory.yaml
4.部署ingress-nginx-controller
kubectl apply -f mandatory.yaml
5.部署ingress-nginx-sevice
kubectl apply -f service-nodeport.yaml
6.部署ingress-nginx
vi ingress-hr-web.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress-hr-web
namespace: default
annotations:
kubernets.io/ingress.class: "nginx"
spec:
rules:
- host: hr-web.liuyu.com
http:
paths:
- path:
backend:
serviceName: hr-web-svc
servicePort: 8999