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
Installed?
minikube version
kubectl -h
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
Testing Deployments
test the kubernetes by creating a new deployment for Nginx web server
mkdir -p projects/nginx/
cd projects/nginx/
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
create the deployment: kubectl create -f nginx-deployment.yaml
check the Kubernetes deployment:
kubectl get deployments
kubectl describe deployments nginx-deployment
nginx-deployment on list ? if yes, ok.
check the Kubernetes service
kubectl get services
kubectl describe services nginx-service
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/
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)