How to update application code which is deployed to Kubernetes (EKS)?

10/10/2018

I have configured the cluster for guestbook-go application by using EKS https://github.com/kubernetes/examples/tree/master/guestbook-go

and followed the official tutorial https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html

Let's say I want to amend public/index.html file. In a Docker file I can see that the file is copied to the container:

COPY ./public/index.html public/index.html

In the guestbook-controller.json I can see the image that it was used: "image":"k8s.gcr.io/guestbook:v3",

What is the correct way to modify index.html and deploy this new version? Do I need to rebuild this image? Then where is the right place to upload it and how to deploy it with kubernetes tools on AWS?

Many thanks, as a newcomer to Kubernetes, looking for good steps to learn it

-- laimison
amazon-eks
docker
kubernetes

1 Answer

10/10/2018

Here are the steps at a high level to setup a fresh application with new image.

  1. Do a git clone of the repository.

  2. Modify the public/index.html locally.

  3. Do a Docker build using docker build ....

  4. Push the image to a registry (https://hub.docker.com/ or https://cloud.google.com/container-registry/ or some where else). The command depends on the registry. Also, make sure that the image is public.

  5. Update the image appropriately in guestbook-controller.json.

  6. Follow the steps as mentioned in the README.md.

If you want to update the image in an existing K8S application already running, then a rolling-update has to be done as mentioned here.

FYI ..... Without creating the image, the index.html can also be modified by copying the new index.html to all the running Pods as mentioned here.

FYI ..... the example uses ReplicationController which is outdated (mentioned in guestbook-controller.json), a Deployment is the recommended way.

-- Praveen Sripati
Source: StackOverflow