Deploy Kubernetes applications and build images containers in Windows?

Tram Ho

Surely anyone who has ever installed Docker Desktop on Windows doesn’t want to go back a second time, let alone deploy K8S on Windows.

My friend’s younger brother studied information technology, born in 99. At first, he coded on Linux, but no one cared. Since reading this post, my life has changed completely. There was another girl, an Australian student, and was introduced by her sister to work as a VIB bank. How did he go to open a credit card and he caught both my sister and me. The three of them live in a luxury apartment. The other girl’s family knew about the initial objection, after knowing that this guy Deploy Kubernetes applications and building image containers on Windows, she changed her attitude, three times to ask, five times to give gifts to please, always urge to get married lest you miss a good deal.

1. Install Rancher Desktop on Windows

Thanks to the engineers at Rancher Labs / SUSE for making it easy to install the Container Runtime and create a Kubernetes cluster on Windows!

image.png

After downloading, Rancher Installer will automatically install all, we just need to wait! This is the main interface of Rancher Desktop:

image.png

You can choose to use Container Runtime as docker or docker , nerdctl scripts are the same and can interact with COMPOSE

image.png

Next, select enable Kubernetes if you want to create a K8S cluster on Windows, Rancher will support installing both kubectl and helm tools for you.

image.png

2. Hello World Example

In this article, I will show you how to simply get started with Rancher Desktop by building a container image and deploying a pod to K8S from the created image.

Create a folder containing the index.html file with VSCODE

image.png

Create a Dockerfile file with the following content:

image.png

Build images

image.png

Check the created container images

image.png

Deploy to Kubernetes

Use the flag –image-pull-policy=Never to let K8S use local images instead of pulling images from a remote repository.

image.png

Open a web browser at localhost:8080 , and you should see the message Hello World from NGINX!!.

image.png

 

Share the news now

Source : Viblo