Monday, April 10, 2023

Docker and Kubernetes install in the windows

 

How to quickly run Docker and Kubernetes in the windows machine


Step-1: Install docker desktop version from docker. Use this link https://docs.docker.com/desktop/install/windows-install/ to setup docker desktop. Create user name and password for docker hub. We need it to crate docker images.

 

Step-2: Install WSL 2 to enable Linux Kernal in the windows machine.

 

Step-3:  After successfully docker desktop installed, check docker version using cmd. >>docker version

 

Step-4: After docker successfully installed, now enable Kubernetes from docker. Go to docker setting >> then there is Kubernetes left side bar >> then

·        Enable Kubernetes

·        Show System Containers (advance)

·        Then apply and install

 

Step-5: After successfully installed Kubernetes, both Docker and Kubernetes will show running with green in the down right corner of the docker desktop window.

 

Step-6: Now check Kubernetes version using cmd. >>kubectl version. Now you do all based on the Kubernetes.

 

Step-7: Now let’s install Kubernetes dashboard. First login to the Docker Hub using the link: https://hub.docker.com/ . After login click Explore button then find kubernetesui/dashboard. Then down the Kubernetesui/dashboard option, click the link https://github.com/kubernetes/dashboard to details install steps.

 

Step-8: To install Kubernetes, click this link kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml 
After steps-8 done, then move to Step-9.
 

Step-9: execute tow command using PowerShell.

>>kubectl proxy

 

Step-10: Now access dashboard using this link: http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/

After hitting the link, application will ask for Token


To get the Token:

Step-11: Create a folder in the any Drive. Let’s take an example: KubernetesTokenFolder in D drive. Now create two files with the name:

·        ServiceAccount.yaml

The contents of the file  

 

apiVersion: v1

kind: ServiceAccount

metadata:

  name: admin-user

  namespace: kubernetes-dashboard

 

·        ClusterRoleBinding.yaml

The contents of the file  

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

 

Step-12: Now run the above two file using the below sequences after moving into the KubernetesTokenFolder folder.

>> kubectl apply -f .\ServiceAccount.yaml

>> kubectl apply -f .\ClusterRoleBinding.yaml

 

Step-13: To get Token run the below command

>> kubectl -n kubernetes-dashboard create token admin-user

After that you will get token, copy token and past in the Token asking text box. Preserve Token for future reference is needed.

 

Wonderful… Now Kubernetes is running successfully. Enjoy

 

Docker Desktop:




Kubernetes Dashboard:



No comments: