Kubernetes : Minikube on CentOS 7
Deploy Kubernetes on a developer's workstation.
This example is on CentOS 7with KVM. It is a VM. To follow along, you'll need metal or nested KVM.
It can be used to develop applications locally and then publish them to OpenShift, GKE or even Azure AKS.
Install the required packages and start libvirt
yum -y install qemu-kvm libvirt libvirt-daemon-kvm
systemctl enable --now libvirtd
Setup the repo for Kubernetes.
cat <<'EOF' > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
Install Kubectl
yum -y install kubectl
Download the minikube binary and docker machine driver
wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 -O minikube
wget https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-kvm2
chmod 755 minikube docker-machine-driver-kvm2
mv minikube docker-machine-driver-kvm2 /usr/local/bin/
Run a quick minikube check to make sure it's working.
minikube version
minikube version: v1.0.1
Run a kubectl check
kubectl -o json
{
"clientVersion": {
"major": "1",
"minor": "14",
"gitVersion": "v1.14.1",
"gitCommit": "b7394102d6ef778017f2ca4046abbaa23b88c290",
"gitTreeState": "clean",
"buildDate": "2019-04-08T17:11:31Z",
"goVersion": "go1.12.1",
"compiler": "gc",
"platform": "linux/amd64"
}
}
Start minikube
minikube start --vm-driver kvm2
After the the start command runs, check the status
minikube status
You should see out put like this.
host: Running
kubelet: Running
apiserver: Running
kubectl: Correctly Configured: pointing to minikube-vm at 192.168.39.33
Setup the environment
minikube docker-env
Output will look like this:
Kubernetes master is running at https://192.168.39.33:8443
KubeDNS is running at https://192.168.39.33:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Log into the minikube
minikube ssh
Check the docker status
docker ps
At this point you are in a normal VM shell. All tools work as expected.
To stop minikube.
minikube stop
To remove minikube, do like follows
minikube delete
No Comments