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

wrrgggsh  于 2023-11-17  发布在  Kubernetes
关注(0)|答案(1)|浏览(154)

所以我更新了清单,并将apiVersion:extensions/v1 beta1替换为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(downtime:()),但如果您尝试输出部署的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/v1 beta1
我做错了什么?
我正在准备将eks kubernetes v1.15迁移到v1.16

rsaldnfx

rsaldnfx1#

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

kubectl get deployments.v1.apps

字符串
你应该看到你的Deployment,但与apps/v1 apiGroup。

相关问题