Running a custom docker image on GKE

0 votes
I want to use my custom docker image that I build on my machine on GKE. How can I do that?
Sep 18, 2018 in Kubernetes by Atul
• 5,470 points
78 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You'll have tom push your image to Google Container Registry and then refer it form your pod manifest.

Make sure that your DOCKER_HOST is setup properly, your Google Container Engine is running the latest version kubernetes and you have Google Cloud SDK installed.

  1. Setting environment variables

    gcloud components update kubectl
    gcloud config set project <your-project>
    gcloud config set compute/zone <your-cluster-zone>
    gcloud config set container/cluster <your-cluster-name>
    gcloud container clusters get-credentials <your-cluster-name>
    
  2. Tagging image

    docker tag <your-image> gcr.io/<your-project>/<your-image>
    
  3. Push it on the registry

    gcloud docker push gcr.io/<your-project>/<your-image>
    
  4. Pod manifest for your container: my-pod.yaml

    id: my-pod
    kind: Pod
    apiVersion: v1
    desiredState:
      manifest:
        containers:
        - name: <container-name>
          image: gcr.io/<your-project>/<your-image>
        ...
    
  5. Schedule pod

    kubectl create -f my-pod.yaml
    
  6. If you have multiple pods setup do this from step 4 for each of them. You can also have multiple definitions in a line using --- as delimiter
answered Sep 18, 2018 by ajs3033
• 7,000 points

Related Questions In Kubernetes

+2 votes
3 answers

local docker image on minikube

Try something like this: # Start minikube minikube start # ...READ MORE

answered Aug 29, 2018 in Kubernetes by Nilesh
• 6,900 points
2,264 views
0 votes
1 answer

image can't be pulled error when I try to pull a docker image - kubernetes

I think the image is being pulled ...READ MORE

answered Sep 4, 2018 in Kubernetes by Kalgi
• 35,750 points
181 views
0 votes
1 answer

How can I access a service installed on Kubernetes from anywhere?

I have followed the link which you have ...READ MORE

answered Jul 23, 2018 in Kubernetes by Atul
• 10,200 points
70 views
0 votes
1 answer

Running Kubernetes on Mac

This error occurs becaouse you have to ...READ MORE

answered Aug 28, 2018 in Kubernetes by Kalgi
• 35,750 points
23 views
0 votes
1 answer
0 votes
1 answer
0 votes
2 answers
0 votes
1 answer

Forcing ssl for Kubernetes Ingress on GKE

https://github.com/kubernetes/ingress-gce#frontend-https If you want to block http, you ...READ MORE

answered Sep 6, 2018 in Kubernetes by ajs3033
• 7,000 points
686 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.