With the release of Kubernetes on Docker for desktop, Today I will show you how to get familiar with Kubernetes on Docker for Windows on Windows 10 1709 release.
Back in January 2018 docker added support for Kubernetes and in its current release It is only available on the Edge (18.2 and above) channel and runs on Windows 10 1709.
In this article, I will show you where Kubernetes command line located and all the commands you will need to manage, troubleshoot and deploy Containers.
Kubernetes is an open-source system for automating deployment, scaling and management of containerized applications that was originally designed by Google and donated to the Cloud Native Computing Foundation.
It aims to provide a “platform for automating deployment, scaling, and operations of application containers across clusters of hosts”. It supports a range of container tools, including Docker.
The good thing about Docker for Windows is that Kubernetes is integrated into the build and there is no need to install it manually because it automatically installed.
To find which version of Kubernetes you are running right click on the docker icon and click on about and you will see the version number you are running.
You can also use you the Kubectl command below to get more information about the build you are running as you can see below.
Point Kubernetes to Docker
To let Kubernetes be managed by Docker for desktop, you need to run the commands below, the first one will tell you if Docker is managing Kubernetes and the second one will make docker use Kubernetes as his cluster and not swarm.
kubectl config get-contexts kubectl config use-context docker-for-desktop
The Kubernetes command line tool is located in the path below and if you are not adding this path to windows you will need to navigate to it if you want to run Kubernetes commands.
To add Kubernetes to the windows command line path run the line below from PowerShell.
[Environment]::SetEnvironmentVariable("KUBECONFIG", $HOME + "\.kube\config", [EnvironmentVariableTarget]::Machine)
Note: It is recommended to use PowerShell 6.0 as the command line console for Kubernetes and Docker management.
To view Kubernetes configuration details like Port, name and other information using the command below.
kubectl config view
The Kubernetes configuration file is located in (use your username) the path below
This is how the configuration file looks like
Cluster and Nodes
To view your Kubernetes cluster info, Nodes and Pods details you can use the commands below
kubectl.exe cluster-info kubectl get nodes --all-namespaces kubectl get pods --all-namespaces
To delete a deployed stack, Services and specific stack deployment use the commands below
docker stack rm webapp1 kubectl.exe get services docker stack services webapp1
This post was first published on DeployContainers.com