Kubernetes Deep Dive

Sign Up Free or Log In to participate!

How do I run the Deployment Demo at the end of of Chapter 6 on GCP?

I am having trouble doing the same.

I have modified the file slightly to push the container image to GCR instead of Docker’s container repo.

For that I have modified the web-deploy.yml like so

”’

  • image: gcr.io/playground-s-11-cf7219e0/imagectr:latest

name: web-ctr

ports:

  • containerPort: 8080

”’

I had also pushed the image to the particular repository using the instructions here:https://cloud.google.com/container-registry/docs/pushing-and-pulling

But when I try to run it by following the same step as in the video otherwise, it does not work. Should I restart with a fresh cluster?

1 Answers

Hi Anshumankmr, 

You don’t need to change anything in the code. 

To have access to an application running on kubernetes, you will need need a load balancer.

Nigel supplied the web-lb.yml. So all that you need to do is to deploy it:

$ kubectl apply -f ./web-lb.yml

Then, check it for the public IP address:

$ kubectl get svc web-svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
web-svc LoadBalancer 10.108.0.89 34.75.254.254 80:30527/TCP 4m51s

Now you just need to copy the load balancer public IP address (34.75.254.254 in my case) and paste it on your browser.

HTH

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?