[root@master ~]# kubectl create -f ingress-nginx-V0.24.1.yaml
namespace/ingress-nginx created
configmap/nginx-configuration created
configmap/tcp-services created
configmap/udp-services created
serviceaccount/nginx-ingress-serviceaccount created
clusterrole.rbac.authorization.k8s.io/nginx-ingress-clusterrole created
role.rbac.authorization.k8s.io/nginx-ingress-role created
rolebinding.rbac.authorization.k8s.io/nginx-ingress-role-nisa-binding created
clusterrolebinding.rbac.authorization.k8s.io/nginx-ingress-clusterrole-nisa-binding created
deployment.apps/nginx-ingress-controller created
[root@master ~]#
查看ingress-nginx命令空间中的pod
[root@master ~]# kubectl get pods -n ingress-nginx
NAME READY STATUS RESTARTS AGE
nginx-ingress-controller-9cb7c48cd-qdz8k 1/1 Running 0 17s
[root@master ~]#
查看dc:
[root@master ~]# kubectl get deployments.apps -n ingress-nginx
NAME READY UP-TO-DATE AVAILABLE AGE
nginx-ingress-controller 1/1 1 1 80s
[root@master ~]#
查看service:
[root@master ~]# kubectl get service -n ingress-nginx
No resources found in ingress-nginx namespace.
创建ingress服务发布:
[root@master ~]# kubectl expose deployment nginx-ingress-controller --name=ingress-nginx --type=NodePort -n ingress-nginx
service/ingress-nginx exposed
[root@master ~]# kubectl get service -n ingress-nginx
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ingress-nginx NodePort 10.1.27.77 <none> 80:30011/TCP,443:30705/TCP 10s
[root@master ~]