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!
After downloading, Rancher Installer will automatically install all, we just need to wait! This is the main interface of Rancher Desktop:
You can choose to use Container Runtime as docker or docker
, nerdctl
scripts are the same and can interact with COMPOSE
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.
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
1 2 | <h1>Hello World from NGINX!!</h1> |
Create a Dockerfile file with the following content:
1 2 3 4 | FROM nginx:alpine COPY ./nginx/index.html /usr/share/nginx/html |
Build images
1 2 3 4 | nerdctl --namespace k8s.io build --tag nginx-helloworld:latest . docker build --tag nginx-helloworld:latest . |
Check the created container images
1 2 3 4 | nerctl -n k8s.io images docker images |
Deploy to Kubernetes
Use the flag –image-pull-policy=Never to let K8S use local images instead of pulling images from a remote repository.
1 2 3 4 | kubectl run hello-world --image=nginx-helloworld:latest --image-pull-policy=Never --port=80 kubectl port-forward pods/hello-world 8080:80 |
Open a web browser at localhost:8080
, and you should see the message Hello World from NGINX!!.