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,550 points
529 views

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

Related Questions In Kubernetes

+5 votes
4 answers

local docker image on minikube

I know this is an old question ...READ MORE

answered Feb 1, 2020 in Kubernetes by anonymous
16,794 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
• 52,310 points
2,811 views
0 votes
2 answers

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

if u want to directly want to ...READ MORE

answered Jul 26, 2020 in Kubernetes by Akash Gupta
444 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
• 52,310 points
116 views
+1 vote
1 answer
+2 votes
1 answer
0 votes
2 answers

Using a local image to create a pod in K8s

I'm not sure but you can try ...READ MORE

answered Apr 29, 2019 in Kubernetes by Vishaka
16,607 views
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,280 points
3,170 views