gpt4 book ai didi

kubernetes - k8s v1.26.3 上的入口端点

转载 作者:行者123 更新时间:2023-12-03 07:55:37 33 4
gpt4 key购买 nike

尝试在 k8s v1.26.3 上创建入口端点时出现以下错误。我使用 kops 创建了一个 k8s 集群。

服务器错误

(BadRequest): error when creating "ingress.yaml": Ingress in version"v1" cannot be handled as a Ingress: strict decoding error: unknownfield "spec.rules[0].http.paths[0].backend.serviceName", unknown field"spec.rules[0].http.paths[0].backend.servicePort"

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
labels:
env: prod
app: demo-ms
layer: frontend
name: prod-demo-ingress
namespace: prod
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: demo.abc.in
http:
paths:
- backend:
serviceName: prod-demo-service
servicePort: 8080
path: /
~~~

最佳答案

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: prod-demo-ingress
namespace: prod
labels:
env: prod
app: demo-ms
layer: frontend
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: demo.abc.in
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: prod-demo-service
port:
number: 8080

关于kubernetes - k8s v1.26.3 上的入口端点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76107126/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com