如何在群集升级之前正确更新清单的apiVersion



所以我确实更新了清单,并将apiVersion:extensions/v1beta1替换为apiVersion:apps/v1

apiVersion: apps/v1
kind: Deployment
metadata:
name: secretmanager
namespace: kube-system
spec:
selector:
matchLabels:
app: secretmanager
template:
metadata:
labels:
app: secretmanager
spec:
...

然后我应用了更改

k apply -f deployment.yaml
Warning: kubectl apply should be used on resource created by either kubectl create --save-config or kubectl apply
deployment.apps/secretmanager configured

我也试过

k replace --force -f deployment.yaml

这重新创建了POD(停机时间:((,但如果您尝试输出部署的yaml配置,我仍然会看到旧值

k get deployments -n kube-system secretmanager -o yaml 
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "1"
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"apps/v1","kind":"Deployment",
"metadata":{"annotations":{},"name":"secretmanager","namespace":"kube-system"}....}
creationTimestamp: "2020-08-21T21:43:21Z"
generation: 2
name: secretmanager
namespace: kube-system
resourceVersion: "99352965"
selfLink: /apis/extensions/v1beta1/namespaces/kube-system/deployments/secretmanager
uid: 3d49aeb5-08a0-47c8-aac8-78da98d4c342
spec:

所以我仍然看到apiVersion:extensions/v1beta1

我做错了什么

我正在准备将eks kubernetes v1.15迁移到v1.16

Deployment存在于多个apiGroup中,因此它是不明确的。尝试用指定例如apps/v1

kubectl get deployments.v1.apps

您应该看到您的Deployment,但带有apps/v1apiGroup。

相关内容

  • 没有找到相关文章

最新更新