Here’s a BIG news for the entire Container Community – “Kubernetes Support is coming to Docker Platform“. What does this mean? This means that developers and operators can now build apps with Docker and seamlessly test and deploy them using both Docker Swarm and Kubernetes. This announcement was made on the first day of Dockercon EU 2017 Copenhagen where Solomon Hykes, Founder of Docker invited Kubernetes Co-Founder Tim Hockin on the stage for the first time. Tim welcomed the Docker family to the vibrant Kubernetes world.
In case you missed out the news, here are the important takeaways from Docker-Kubernetes announcement –
- Kubernetes support will be added to Docker Enterprise Edition for the first time.
- Kubernetes support will be added optionally to Docker Community Edition for Mac and Windows.
- Kubernetes and Docker Swarm both orchestrators will be available under Docker Platform.
- Kubernetes integration will be made available under Moby projects too.
Docker Inc firmly believes that bringing Kubernetes to Docker will simplify and advance the management of Kubernetes for developers, enterprise IT and hackers to deliver the advanced capabilities of Docker to a broader set of applications.
Please be aware that the beta program is expected to be ready at the end of 2017.
Can’t wait for beta program? Here’s a quick guide on how to get Multi-Node Kubernetes cluster up and running using LinuxKit.
Under this blog post, we will see how to build 5-Node Kubernetes Cluster using LinuxKit. Here’s the bonus – We will try to deploy WordPress application on top of Kubernetes Cluster. I will be building it on my macOS Sierra 10.12.6 system running the latest Docker for Mac 17.09.0 Community Edition up and running.
- Ensure that the latest Docker release is up and running.
2. Clone the LinuxKit repository:
$sudo git clone https://github.com/ajeetraina/linuxkit
3. Execute the below script to build Kubernetes OS images using LinuxKit & Moby:[simterm]
$sudo chmod +x script4k8s.sh[/simterm]
All I have done is put all the manual steps under a script as shown below:
This should build up Kubernetes OS image.
Run the below command to know the IP address of the kubelet container:[simterm]
$ip adds show dev eth0[/simterm]
You can check the list of tasks running as shown below:
Once this kubelet is ready, it’s time to login into it directly from a new terminal:[simterm]
$sudo ./ssh_into_kubelet.sh 192.168.65.3[/simterm]
So you have already SSH into the kubelet container rightly named “LinuxKit Kubernetes Project”.
We are going to mark it as “Master Node”.
Initializing the Kubernetes Master Node
Now it’s time to manually initialize master node with Kubeadm command as shown below:[simterm]
Wait for few minutes till kubeadm command completes. Once done, you can use kubeadm join argument as shown below:
Your Kubernetes master node gets initialized successfully as shown below:
It’s time to run the below list of commands command to join the list of worker nodes:[simterm]
$sudo ./boot.sh 1 –token 4cec03.1a7ccb44115f427a 192.168.65.3:6443
$sudo ./boot.sh 2 –token 4cec03.1a7ccb44115f427a 192.168.65.3:6443
$sudo ./boot.sh 3 –token 4cec03.1a7ccb44115f427a 192.168.65.3:6443
$sudo ./boot.sh 4 –token 4cec03.1a7ccb44115f427a 192.168.65.3:6443[/simterm]
It brings up 5-Node Kubernetes cluster as shown below:
Deploying WordPress Application on Kubernetes Cluster:
Let us try to deploy a WordPress application on top of this Kubernetes Cluster.
Head over to the below directory:[simterm]
Creating a Persistent Volume[simterm]
$kubectl create -f local-volumes.yaml[/simterm]
The content of local-volumes.yml look like:
This creates 2 persistent volumes:
Verifying the volumes:
Creating a Secret for MySQL Password[simterm]
kubectl create secret generic mysql-pass --from-literal=password=mysql123
Verifying the secrets using the below command:
$kubectl get secrets[/simterm]
$kubectl create -f mysql-deployment.yaml
Verify that the Pod is running by running the following command:
$kubectl get pods[/simterm]
$kubectl create -f wordpress-deployment.yaml
By now, you should be able to access WordPress UI using the web browser.
Did you find this blog helpful? Feel free to share your experience. Get in touch @ajeetsraina.
If you are looking out for contribution/discussion, join me at Docker Community Slack Channel.