A few months ago Kubernetes announced the depreciation of Docker in the next version, in a previous post I explained why. Kubernetes is deprecating Docker in the upcoming release..
The purpose of this post is to use the work done in the post : Installing Kubernetes on bare-metal with Terraform and kubeadm to install kubernetes without docker but with CRI-O and you show that it doesn’t change anything the execution of Docker images.
Prerequisites
Before you get started, you’ll need to have these things:
- Terraform > 0.13.x
- kubectl installed on the compute that hosts terraform
- A minimum of two servers installed with Centos or RedHat Enterprise (Release : 7.x - 8.x)
- On each servers :
- Generate a ras ssh key.
- Update the authorized_keys file with the public keys
Infra
Initial setup
Clone the repository and install the dependencies:
Usage
Create an bare-metal Kubernetes cluster with one master and two nodes:
If you use the terraform apply command without parameters the default values will be those defined in the variables.tf file.
This will do the following :
- connects to the master server via SSH and installs CRIO , kubeadm and rpm packages
- runs kubeadm init on the master server and configures kubectl
- installs Weave Net with encrypted overlay
- install cluster add-on (Kubernetes dashboard)
- create a ServiceAccount : admin-user and set authorization
- connects to the workers via SSH and installs CRIO , kubeadm and rpm packages
- starts the worker nodes
- joins the worker nodes in the cluster using the kubeadm token obtained from the master
Scale up by add hostname or ip address in worker variable
Tear down the whole Terraform plan with :
Resources can be destroyed using the terraform destroy command, which is similar to terraform apply but it behaves as if all of the resources have been removed from the configuration.
Remote control
Check if your cluster works:
We can see that we use CRI-O instead of docker.
if we used docker we would have the following result :
To access the dashboard you’ll need to find its cluster IP :
Get token for the connection to the dashboard :
copy and paste the token value in the dashboard connection window (in next step)
Open a SSH tunnel:
Now you can access the dashboard on your computer at http://localhost:8888. Paste the token value :
We can use the OpenEBS installation with the CSI Driver described in the previous posts (Using HELM Chart to Deploying OpenEBS to an Kubernetes Cluster using Terraform and OpenEBS CStor CSI Driver. ) and deploy our SQL Server instance, it will not have any change.
We will deploy a SQL Server instance, to verify that it works using CRI-O. We will use the following yaml file: deploy-mssql-s.yaml
Check if your SQL Server instance works:
It is running cool ….
To access the SQL Server Instance you’ll need to find its port map :
In our deployment for the service we used the NodePort directive and port 1433 is mapped externally to port 32239. We can access our instance by specifying the name (or ip address) of one of the cluster nodes and port 32239.
You can connect to the SQL Server instance outside the Kubernetes cluster with command line :
Conclusion
We just saw that not using docker with kubernetes doesn’t change the way we use our docker created containers. Migrating to another runtime container than Docker (to continue using kubernetes) is completely transparent.
Resources :
CRI-O Installation Instructions