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,530 points

1 answer to this question.

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><your-project>/<your-image>
  3. Push it on the registry

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

    id: my-pod
    kind: Pod
    apiVersion: v1
        - name: <container-name>
  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,280 points

Related Questions In Kubernetes

+3 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,880 points
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
• 41,660 points
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,240 points
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
• 41,660 points
0 votes
1 answer
0 votes
1 answer
0 votes
2 answers
0 votes
1 answer

Forcing ssl for Kubernetes Ingress on GKE If you want to block http, you ...READ MORE

answered Sep 6, 2018 in Kubernetes by ajs3033
• 7,280 points