nginx-ingress-controller

manifests 方式部署

以下为 manifests 方式部署 Nginx 公司自己的 Nginx Ingress Controller

官方文档:

https://docs.nginx.com/nginx-ingress-controller/installation/installing-nic/installation-with-manifests/

拉取代码至本地

git clone https://github.com/nginx/kubernetes-ingress.git --branch v4.0.1
cd kubernetes-ingress

创建所需配置文件

kubectl apply -f deployments/common/ns-and-sa.yaml
kubectl apply -f deployments/rbac/rbac.yaml
kubectl apply -f deployments/common/nginx-config.yaml

kubectl apply -f deployments/common/ingress-class.yaml
# 不指定 ingressClassName 的 ingress 都默认使用它,需进行如下修改
# If you want to make this NGINX Ingress Controller instance your cluster’s default,
# uncomment the "ingressclass.kubernetes.io/is-default-class" annotation.
# This action will auto-assign IngressClass to new ingresses that don’t specify an ingressClassName.

创建自定义资源并以 Deployment 方式创建 NGINX Ingress Controller

curl -O https://raw.githubusercontent.com/nginx/kubernetes-ingress/v4.0.1/deploy/crds.yaml
kubectl apply -f crds.yaml

kubectl apply -f deployments/deployment/nginx-ingress.yaml

查看状态

kubectl -n nginx-ingress get pods

kubectl -n nginx-ingress describe pod nginx-ingress-7cf5476c47-c7mw6

kubectl -n nginx-ingress logs nginx-ingress-7cf5476c47-c7mw6

访问 NGINX Ingress Controller

kubectl create -f deployments/service/nodeport.yaml

Last updated