kubernetes - Kubernetes 联合部署每个集群的不同镜像 url
问题描述
知道如何定义 Kubernetes 联合部署以使用来自不同注册表的不同图像 url?
我有一个 GKE 集群的联合集群,我希望部署为他们的本地 GCR 拉取。
apiVersion: extensions/v1beta1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: nginx-deployment
annotations:
federation.kubernetes.io/deployment-preferences: |
{
"rebalance": true,
"clusters": {
"federation-br": {
"minReplicas": 1,
"maxReplicas": 1,
"weight": 1
},
"federation-eu": {
"minReplicas": 3,
"weight": 1
},
}
}
spec:
selector:
matchLabels:
app: nginx
replicas: 5 # tells deployment to run 2 pods matching the template
template: # create pods using pod definition in this template
metadata:
# unlike pod-nginx.yaml, the name is not included in the meta data as a unique name is
# generated from the deployment name
labels:
app: nginx
spec:
containers:
- name: nginx
image: eu.gcr.io/nginx/proj/app:master.SHAslug
ports:
- containerPort: 80
我想根据集群位置使用所有 eu.gcr.io、us.gcr.io、asia.gcr.io。
还是我真的想要?
解决方案
使用联合部署的目的是为跨多个集群的部署提供一个配置文件。唯一可行的方法是在 YAML 文件中包含一个变量。但是,这似乎不是 YAML 文件的选项。看起来这不是一个选择。
推荐阅读
- python - 如何单击迭代 Selenium 中的 Web 元素列表?
- python - OpenCV:imdecode 内存中的图像返回无
- android - 如何在带有 RTL 字符的 RTL TextView 中将电话号码设置为 LTR
- javascript - 使用 React Native 打开键盘时更新滚动视图
- java - 如何将哈希映射中的值映射到链接列表?
- python - Kivy:GridLayout 中的按钮有间隙
- python - 自动化脚本:如果 FieldA = 1,则将 FieldB 设置为“一”
- python - 如何制作大量Z1189不同排列的网站?
- javascript - 重命名作为 React 状态一部分的键值
- delphi - 无法检查是否已创建类