题目要求
在namespace ingress-kk下有一个 ingress ,但是它貌似不能被正常访问请排除出原因,并修复。
参考
https://kubernetes.io/zh-cn/docs/concepts/services-networking/service/
https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#expose
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| apiVersion: v1 kind: Service metadata: name: my-service spec: selector: app.kubernetes.io/name: MyApp ports: - protocol: TCP port: 80 targetPort: 9376
kubectl expose -h
|
解答
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| kubectl -n ingress-kk get all
kubectl -n ingress-kk
kubectl -n ingress-kk get deployments.apps nginxdep -oyaml ··· name: nginx-lab containerPort: 80 ···
kubectl -n ingress-kk get ingress -o yaml ... service: name: nginxsvc-kk port: number: 80 ...
kubectl expose deployment nginxdep --port=80 --protocol=TCP --target-port=80 --name=nginxsvc-kk --selector name=nginx-lab
...
|