Kubernetes Ingress API版本networking.k8s.io/v1
相对于extensions/v1beta1有很多字段方面的变化,如下所示:
Kubernetes Ingress API版本networking.k8s.io/v1
相对于extensions/v1beta1有很多字段方面的变化,如下所示:
* `spec.backend` -> `spec.defaultBackend`
* `serviceName` -> `service.name`
* `servicePort` -> `service.port.name` (for string values)
* `servicePort` -> `service.port.number` (for numeric values)
* `pathType` no longer has a default value in v1; "Exact", "Prefix", or "ImplementationSpecific" must be specified
将所有 ingress yaml 文件从 extensions/v1beta1 转换为 networking.k8s.io/v1 的最简单方法是什么?
看起来 kubectl convert 在 v1.19 中已经被弃用了。
Kubernetes 版本:
kubectl version
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.0", GitCommit:"e19964183377d0ec2052d1f1fa930c4d7575bd50", GitTreeState:"clean", BuildDate:"2020-08-26T14:30:33Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.0", GitCommit:"e19964183377d0ec2052d1f1fa930c4d7575bd50", GitTreeState:"clean", BuildDate:"2020-08-26T14:23:04Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/amd64"}
kubectl convert使用时出现错误:
kubectl convert -f ingress_4_10_1.yaml --output-version networking.k8s.io/v1
kubectl convert is DEPRECATED and will be removed in a future version.
In order to convert, kubectl apply the object to the cluster, then kubectl get at the desired version.
error: networking.Ingress is not suitable for converting to "networking.k8s.io/v1" in scheme "k8s.io/kubernetes/pkg/api/legacyscheme/scheme.go:30"
我的Ingress YAML文件:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: frontend
annotations:
kubernetes.io/ingress.class: "ing-class1"
spec:
rules:
- host: frontend.com
http:
paths:
- path: /web-frontend/frontend.php
backend:
serviceName: frontend
servicePort: 80
kubectl create -o yaml --dry-run
生成 yaml 文件(以便输出最新的 yaml),并根据你的需要配置该文件。 - Popopame