【发布时间】:2021-09-21 22:18:34
【问题描述】:
我有一个 pod egress-operator-controller-manager 通过命令 make deploy IMG=my_azure_repo/egress-operator:v0.1 从 makefile 创建。
此 pod 在描述中显示 unexpected status: 401 Unauthorized 错误,因此我创建了 imagePullSecrets 并尝试通过创建 pod 的 deployment.yaml [egress-operator-manager.yaml] 文件来使用秘密更新此 pod。
但是当我应用这个 yaml 文件时,它给出了以下错误:
root@Ubuntu18-VM:~/egress-operator# kubectl apply -f /home/user/egress-operator-manager.yaml
The Deployment "egress-operator-controller-manager" is invalid: spec.selector: Invalid value:
v1.LabelSelector{MatchLabels:map[string]string{"moduleId":"egress-operator"},
MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable
egress-operator-manager.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: egress-operator-controller-manager
namespace: egress-operator-system
labels:
moduleId: egress-operator
spec:
replicas: 1
selector:
matchLabels:
moduleId: egress-operator
strategy:
type: Recreate
template:
metadata:
labels:
moduleId: egress-operator
spec:
containers:
- image: my_azure_repo/egress-operator:v0.1
name: egress-operator
imagePullSecrets:
- name: mysecret
有人可以告诉我如何更新这个 pod 的 deployment.yaml 吗?
【问题讨论】:
-
这个文件在你的 k8s 集群上的当前配置是什么?错误消息表明“[]v1.LabelSelectorRequirement(nil)}:”已被修改。 nil 值可能表示该值在您的 yaml 文件中不可用,但在当前应用的配置中可用。很可能添加此值将让您应用新配置
-
我正在使用 que 中提到的“make deploy”命令部署这个 pod,如何找到现有 pod 的部署?是否有任何 kubectl 命令来获取正在运行的 pod 的现有部署/配置?
-
是的,有。获取当前部署版本的命令是“kubectl get deployment egress-operator-controller-manager -n egress-operator-system -o yaml”
标签: kubernetes makefile kubernetes-pod azure-container-registry kubernetes-deployment