use*_*321 6 yaml kubernetes kubectl
我正在尝试修补部署,但我一直在打deployment.extensions/velero 未修补。
我尝试了以下几种不同的变体:
kubectl patch deployment velero -n velero -p '{"spec":{"containers":[{"env":[{"name":"AWS_CLUSTER_NAME","value":"test-cluster"}]}]}}'
Run Code Online (Sandbox Code Playgroud)
我的初始 deployment.yaml 文件
apiVersion: apps/v1
kind: Deployment
metadata:
name: velero
labels:
app.kubernetes.io/name: velero
app.kubernetes.io/instance: velero
app.kubernetes.io/managed-by: Tiller
helm.sh/chart: velero-2.1.1
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/instance: velero
app.kubernetes.io/name: velero
template:
metadata:
labels:
app.kubernetes.io/name: velero
app.kubernetes.io/instance: velero
app.kubernetes.io/managed-by: Tiller
helm.sh/chart: velero-2.1.1
spec:
restartPolicy: Always
serviceAccountName: velero-server
containers:
- name: velero
image: "gcr.io/heptio-images/velero:v1.0.0"
imagePullPolicy: IfNotPresent
command:
- /velero
args:
- server
volumeMounts:
- name: plugins
mountPath: /plugins
- name: cloud-credentials
mountPath: /credentials
- name: scratch
mountPath: /scratch
env:
- name: AWS_SHARED_CREDENTIALS_FILE
value: /credentials/cloud
- name: VELERO_SCRATCH_DIR
value: /scratch
volumes:
- name: cloud-credentials
secret:
secretName: cloud-credentials
- name: plugins
emptyDir: {}
- name: scratch
emptyDir: {}
Run Code Online (Sandbox Code Playgroud)
我现在有点卡住了,担心我可能会以错误的方式去做这件事。任何建议将不胜感激。
mch*_*wre 36
除了kubectl patch命令,你还可以使用kubectl set env来更新 k8s 部署的环境变量。
kubectl set env deployment/velero AWS_CLUSTER_NAME=test-cluster
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助。
| 归档时间: |
|
| 查看次数: |
8606 次 |
| 最近记录: |