【发布时间】:2018-05-24 08:06:05
【问题描述】:
知道如何定义 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。
或者我真的想要它?
【问题讨论】:
-
我不会在 kubernetes 前端复杂化。我宁愿使用 docs.microsoft.com/en-us/azure/container-registry/… 之类的东西或其他一些机制来使图像在注册表上高度可用(如果需要的话)。
标签: kubernetes google-kubernetes-engine google-container-registry