gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 11:36:14 26 4
gpt4 key购买 nike

所以我确实更新了 list 并将 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

最佳答案

部署 exists in multiple apiGroups ,所以是模棱两可的。尝试指定例如apps/v1 具有:

kubectl get deployments.v1.apps

您应该会看到您的 Deployment,但带有 apps/v1 apiGroup。

关于kubernetes - 如何在集群升级之前正确更新 list 的 apiVersion?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63530511/

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