In this guide, we will walk through the process of enabling Kubernetes in Docker Desktop and deploying a Java application on a Kubernetes cluster node by using ingress-nginx.
- Installing the Docker Desktop
- Enabling the kubernetes in Docker Desktop
- Building Docker Images
- Deploying the java application in kubernetes cluster
Installing the Docker Desktop
- WSL version 126.96.36.199 or later.
- Windows 11 64-bit: Home or Pro version 21H2 or higher, or Enterprise or Education version 21H2 or higher.
- Windows 10 64-bit: Home or Pro 21H2 (build 19045) or higher, or Enterprise or Education 21H2 (build 19045) or higher.
- Turn on the WSL 2 feature on Windows.
The following hardware prerequisites are necessary for successfully running WSL 2 as a backend on Windows 10 or Windows 11.
64-bit processor , 8GB system RAM, BIOS-level hardware virtualization support must be turned on in the BIOS settings
Download Docker Desktop by following the link, then install it and reboot your system.
After licensing, if you encounter a “Docker Desktop required a newer WSL kernel version” error, you can resolve it by updating the kernel using the “wsl-update” command.
At the end, we have installed and started Docker Desktop. You can verify the Docker engine and client’s running status by using the “docker –version” command.
Enabling the kubernetes in Desktop docker
- In Docker Dashboard, select the Settings and then Kubernetes from the left sidebar.
- Click the checkbox on Enable kubernetes and apply & restart, save the setting.
Kubernetes containers will be hidden within Docker Desktop containers, and they won’t appear in commands like “docker ps.” To view the Docker Kubernetes containers, navigate to Settings -> Kubernetes, check the “Show system containers (advanced)” checkbox, and then click apply & restart.
You can verify the status of the local Kubernetes cluster nodes by using the command “kubectl get node.”
Building Docker Images
Here is a sample Dockerfile for a java application to build a Docker image.