0

any idea how to define a Kubernetes federated deployment to use different image urls from different registries?

I have a federated cluster of GKE cluster and I want the deployment to pull for their local 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

I wanna use all eu.gcr.io, us.gcr.io, asia.gcr.io based on the cluster location.

Or do I really want it?

bartimar
  • 3,374
  • 3
  • 30
  • 51
  • I wouldn't complicate this on the kubernetes front. I would rather use something like https://learn.microsoft.com/en-us/azure/container-registry/container-registry-geo-replication or some other mechanism to make images highly available on the registry (If needed at all). – Amrit May 24 '18 at 08:30

1 Answers1

-1

The purpose of using a federated deployment is to have a single config file for the deployment across multiple clusters. The only way you could do it is if you could include a variable within the YAML file. However, this does not seem like an option with YAML files. Looks like this isn't an option.

Patrick W
  • 4,603
  • 1
  • 12
  • 26