Today, I show you how to install Kubernetes with Docker Desktop. Kubernetes is a portable, extensible, open-source platform for automating, deploying, scaling, managing containerized workloads and services, that facilitates both declarative configuration and automation. It runs on all major operating systems (Linux, OSX, Windows). Let’s start.
Install Kubernetes with Docker Desktop
Step 1: Install Hyper-V
In this post, we show you how to install Kubernetes with Docker Desktop on Windows 10. Before processing installation we have to do some configuration on Windows. I noted that Kubernetes requires the latest version of Windows 10 Pro or Enterprise 64-bit edition. Now you make your Windows support virtualization by opening the Turn Windows features on and off popup on Windows then enable Hyper-V like below
Step 2: Install Docker for Windows
Installing Docker on Windows is quite easy. Let go straight to the post Install Docker Desktop on Windows on Docker website. After installing complete don’t forget to start Docker Desktop and login Docker Hub.
Now, you just have Docker installed on your Windows.
Step 3: Install Kubernetes on Windows
After installing Docker on Windows, it’s time to install & enable Kubernetes using the GUI tool that it’s provided by Docker.
- Right-click on the Docker tray icon then click “Settings”
- On the left panel click “Kubernetes” then check everything and click “Apply & Restart” button
After clicking the “Apply & Restart” button, Docker is going to install additional packages. So it may take around 5~10 minutes depends on your Internet speed. The installation completes with the following message
Now, you can verify Kubernetes works smoothly with Docker. If both services Docker and Kubernetes are running, it means that everything went fine without any errors.
So far, you install Kubernetes with Docker Desktop successfully. But you need to setup Kubernetes Dashboard for managing your applications running in Kubernetes cluster. Let’s move to the next step.
Step 4: Setup Kubernetes Dashboard
Kubernetes Dashboard is a web-based UI for Kubernetes clusters. It allows users to manage applications running in the cluster and troubleshoot them, as well as manage the cluster itself. It’s not enabled by default, you must enable manually by the following commands:
- To deploy Dashboard, execute following command:
1 |
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-rc5/aio/deploy/recommended.yaml |
Your console print the output looks like this
- To access Dashboard from your local workstation, just run the following command:
1 |
kubectl proxy |
This command makes Kubernetes Dashboard start to serve on 127.0.0.1:8001
- Access Dashboard at this address:
1 |
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/ |
You will see the response on your browser like below
Step 5: Create An Authentication Token
We are creating Service Account with name admin-user
in namespace kubernetes-dashboard
first. And we put this manifest in a separated file named dashboard-adminuser.yaml
1 2 3 4 5 |
apiVersion: v1 kind: ServiceAccount metadata: name: admin-user namespace: kubernetes-dashboard |
We create ClusterRoleBinding
for our ServiceAccount
, putting this manifest in dashboard-adminuser.yaml
file too.
1 2 3 4 5 6 7 8 9 10 11 12 |
apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: admin-user roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin subjects: - kind: ServiceAccount name: admin-user namespace: kubernetes-dashboard |
Execute the command to create ServiceAccount
and ClusterRoleBinding
1 |
kubectl apply -f dashboard-adminuser.yaml |
Now, we open Windows Powershell to get token then we can login by executing the command:
1 |
kubectl -n kubernetes-dashboard describe secret $(kubectl -n kubernetes-dashboard get secret | sls admin-user | ForEach-Object { $_ -Split '\s+' } | Select -First 1) |
Your Powershell should print the output
Then you copy that token paste it into the login screen
Click Sign in
button and you are now logged in as an admin.
That’s all about Install Kubernetes with Docker Desktop. You just have Kubernetes installed.
If you find this post useful, don't hesitate to share it with your friends or other people for growing knowledge together and is an effort to contribute us.