kubectl 修补现有容器命令
我已经启动并运行了 Kubernetes 部署: (为简洁起见,省略了一些字段)
apiVersion: apps/v1
kind: Deployment
metadata:
name: argocd-server
namespace: argocd
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: argocd-server
template:
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/name: argocd-server
spec:
containers:
- name: argocd-server
image: quay.io/argoproj/argocd:v2.2.5
command:
- argocd-server
我想为现有部署创建一个补丁,以向容器的命令添加某些参数:
- '--insecure'
- '--basehref'
- /argocd
我阅读了有关 kubectl 补丁的文档> 命令 此处,但我不确定如何实际选择我想要修补的容器(按名称或索引)。
覆盖完整的 command:
列表(在补丁文件中给出 - argocd-server
行)就可以了,但我想防止给出完整的 容器:补丁文件中的
规范。
I have a Kubernetes deployment up and running:
(some fields omitted for brevity)
apiVersion: apps/v1
kind: Deployment
metadata:
name: argocd-server
namespace: argocd
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: argocd-server
template:
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/name: argocd-server
spec:
containers:
- name: argocd-server
image: quay.io/argoproj/argocd:v2.2.5
command:
- argocd-server
I would like to create a patch for the existing deployment to add certain arguements to the command
of the container:
- '--insecure'
- '--basehref'
- /argocd
I read the documentation on the kubectl patch
command here, but I am not sure how to actually select the container (by name or index) that I would like to patch.
It would be fine to overwrite the complete command:
list (giving the - argocd-server
line in the patch file) but I would like to prevent giving the complete containers:
spec in the patch file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以通过索引选择容器,例如:
You can select the container by index, e.g.:
感谢 @Blokje5 的启发,我能够构建这两个选项:
JSON 方法
内联
补丁文件
patch.json
YAML 方法
yaml 文件
patch.yaml
Thanks to the inspiration by @Blokje5 I was able to construct these two options:
JSON approach
inline
with patch file
patch.json
YAML approach
yaml file
patch.yaml