1.题目概述
- 创建一个Ingress资源,名称为ping,命名空间ing-internal
-
2.解析
拷贝官方文档的yaml案例,修改相关参数
- 设置成功后通过curl -kl
/hello 来测试 3.参考答案
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ping
namespace: ing-internal
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- http:
paths:
- path: /hello
pathType: Prefix
backend:
service:
name: hello
port:
number: 5678