Source
https://www.youtube.com/watch?v=GKuk-TBmNcI
- Purpose
The goal of this blog is to show how a docker container can be deployed on a Kubernetes cluster. The motivation of deploying containers is as follows
Once you build a container, you may want to scale it up and down according to the changing demand. TO do that, Kubernetes has a Loadbalancer which distributes http requests over a set of Nodes.
Kubernetes architecture
A Kubernetes cluster is formed of nodes. A node can be either worker or master node
Within each Node there are multiple pods. A container is deployed on a pod and the load balancer distributes the requests across the nodes and pods
Build a container
- On cloud shell create a folder and place the following files
- Thats how the Dockerfile looks like
- Build the container using gcloud command
- Create a Kubernetes cluster using this command- Change the number of nodes as you wish
- You can change the number of nodes by modifying the deployment.yaml file as follows
- Then apply this as follows
- To modify the ports of the loadbalancer edit the services.yaml file as follows
- To get the IP to call type the following command
- Just place this IP in the browser and the container will run
No comments:
Post a Comment