DEV Community

sa3i0l
sa3i0l

Posted on

Install kubernetes on Arch

Using root # for most of these commands, usual routine

 pacman -Sy libvirt qemu ebtables dnsmasq usermod -a -G libvirt $(whoami) newgrp libvirt systemctl start libvirtd.service systemctl enable libvirtd.service systemctl start virtlogd.service systemctl enable virtlogd.service pacman -S docker-machine yay -S docker-machine-driver-kvm2 yay -S minikube kubetcl-bin 
Enter fullscreen mode Exit fullscreen mode

Installed?

minikube version kubectl -h 
Enter fullscreen mode Exit fullscreen mode

Kubernetes Initialization with Minikube

Initialize the single-node Kubernetes cluster minikube start --vm-driver kvm2

Kubernetes has been installed on the local computer, using minikube Check:

minikube status kubectl cluster-info kubectl get nodes 
Enter fullscreen mode Exit fullscreen mode

Testing Deployments

test the kubernetes by creating a new deployment for Nginx web server

mkdir -p projects/nginx/ cd projects/nginx/ 
Enter fullscreen mode Exit fullscreen mode

yaml file for deployment configuration: vim nginx-deployment-service.yaml

contents of yaml file:

apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14 ports: - containerPort: 80 --- apiVersion: v1 kind: Service metadata: name: nginx-service labels: run: nginx-service spec: type: NodePort ports: - port: 80 protocol: TCP selector: app: nginx 
Enter fullscreen mode Exit fullscreen mode

create the deployment: kubectl create -f nginx-deployment.yaml

check the Kubernetes deployment:

kubectl get deployments kubectl describe deployments nginx-deployment 
Enter fullscreen mode Exit fullscreen mode

nginx-deployment on list ? if yes, ok.

check the Kubernetes service

kubectl get services kubectl describe services nginx-service 
Enter fullscreen mode Exit fullscreen mode

check at what port 'nginx-service' runs on (PORT(S), NodePort) mine is: 31304

Check the Kubernetes cluster IP and access it using curl command

minikube ip curl -I http://192.168.39.165:31304/ 
Enter fullscreen mode Exit fullscreen mode

If you get response from the Nginx web server, all good. You can access same address on browser, to get webpage..


Access Kubernetes Dashboard

minikube dashboard

Open the Kubernetes dashboard using web browser


Done.

Top comments (0)