查看pod状态
[root@k8s-1 ingress]# kubectl get --namespace=ingress-nginx po -o wide
NAME READY STATUS RESTARTS AGE IP NODE
default-http-backend-2580125250-rx7mq 1/1 Running 5 1d 10.254.81.211 k8s-2
nginx-ingress-controller-nl8md 1/1 Running 0 3d 192.168.0.102 k8s-3
nginx-ingress-controller-rxc3b 1/1 Running 0 3d 192.168.0.101 k8s-2
创建一个测试服务:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx-app
namespace: ingress-nginx
spec:
replicas: 1
template:
metadata:
labels:
name: nginx
spec:
containers:
- name: nginx
image: cail/nginx
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: nginx-max
namespace: ingress-nginx
spec:
ports:
- port: 80
targetPort: 80
protocol: TCP
selector:
name: nginx
kubectl apply -f nginx.yaml
[root@k8s-1 ingress]# kubectl get --namespace=ingress-nginx po
NAME READY STATUS RESTARTS AGE
nginx-app-2763260788-cnzst 1/1 Running 0 1m