Lab 6: Deploying on Kubernetes¶
What am I about to learn?¶
Today's lab session focuses on Kubernetes! We will build a Kubernetes cluster and deploy a containerized application.
Tip
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.
Lorem ipsum dolor sit amet, (1) consectetur adipiscing elit.
- :man_raising_hand: I'm an annotation! I can contain
code, formatted text, images, ... basically anything that can be expressed in Markdown.
The Bonus Lab focuses on how to:
- Deploy Kubernetes on the Google Kubernetes Engine (GKE) in GCP.
- Run the basic commands to interact with and push Docker images to Docker Hub.
- Deploy images from Docker Hub to Kubernetes.
- Horizontally scale images to support increased traffic using a load-balancing service.
You will need to watch the following video to follow the step-by-step commands.
Take your time and make sure you double-check the commands before you run them.
- The following video demonstrates the commands used in this tutorial.
You should run this tutorial on your GCP VM and the Google Cloud Shell
- To run this tutorial, you will need a GCP VM; you must use the Docker VM that we created in Lab 5.
-
Go to Docker Hub and create a new account. We will use Docker Hub to push our images to deploy on Kubernetes.
- The link to Docker Hub: Docker Hub
-
Create a new public repository.
- Add a name and a description; your Docker Hub username is in the top-right corner of your screen.

-
Go back to your Docker VM (from Lab 5) and log in to Docker Hub using your Docker user. If you deleted your VM, create a new one and install Docker.
In the VM, do not forget to switch to
docker-user.
The command issu - docker-user; this ensures that you log in and switch to the docker-user home directory. -
Feel free to use the mini-hi repo or create your own.
- If you create your application, you will need to create a new repo, push your code, and clone it in the VM.
- In my case, I used the public repo
mini-hi.git.
If you want, you can install Docker on your own computer.
* Link: Docker Desktop
Themini-hiapp is a simple Node.js server with a Hello World message. -
Move into the project directory.
-
The Dockerfile is already there (I created it for you 😊). Examine it:
-
Build your image.
- Image name format:
<DockerHub-username>/<image-name>:<version>
- Image name format:
-
Push your image to Docker Hub.
Refresh your Docker Hub page; your image should now appear.
-
Search for your image.
- 0 stars yet 😅 but it’s a start 😄
-
Create a Kubernetes cluster (GKE Standard) in Google Cloud.
- Give it a meaningful name, e.g.
my-gke-cluster. - By default, we deploy 3 nodes.
- This may take a few minutes—sit tight!
- Give it a meaningful name, e.g.
-
Activate the Cloud Shell, connect to your cluster, and copy the connect command:
$ gcloud container clusters get-credentials stelios-cluster13 --zone us-central1-c --project lab-7-270015The
gcloudcommand is part of the Google Cloud CLI used to manage resources. -
Run the following commands to check your connection.
-
Run a container using the
mini-hiimage. -
Check if the pod is running.
Wait until you see
STATUS Running; repeat the command if necessary. -
Describe the pod for more details.
The displayed IP is internal to the cluster.
-
Create a deployment file named
mini-hi-deployment.yaml.apiVersion: apps/v1 kind: Deployment metadata: name: mini-hi-deployment labels: app: minihi spec: replicas: 3 selector: matchLabels: app: minihi template: metadata: labels: app: minihi spec: containers: - name: minihi image: steliosot/mini-hi:1 imagePullPolicy: Always ports: - containerPort: 3000YAML is a human-readable format for configuration files.
It stands for YAML Ain’t Markup Language. -
Delete your previous pod.
-
Apply the deployment file.
-
Get pods again.
-
Scale the deployment. Edit the file and change
replicas: 3→replicas: 10. -
View pod placement across nodes.
-
Create a service file named
mini-hi-service.yaml. -
Apply the service.
-
Check services to find your external IP.
Open that IP in your browser to view the running app.
-
Update your app (new Hello World message), rebuild and push as version 2.
-
Edit the deployment to use the new image and scale to 15 replicas.
Change:
replicas: 15
image: steliosot/mini-hi:2 -
Check pods again.
You’ll see some pods terminating and new ones starting with the updated image.
-
Refresh your browser — your updated app is now live! 🎉
-
Remember to delete your cluster when finished to avoid extra costs.
✅ Result: MkDocs will automatically render proper numbering (1, 2, 3 …) without breaks, while keeping bullets, code blocks, and quotes exactly as expected.
