Kubernates 1 Introduction

alt text

Kubernetes Architecture

Video tutorial followed : https://www.youtube.com/watch?v=a-nWPre5QYI&t=1020s

alt text

1. Deploy a K8s cluster on local Machine.

Deployed ngnix image inside kubernetes and applied load balancer over it

Tools

  • MiniKube
  1. install kubectl with this command :
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"

alt text

  1. make it executable and move to path
sudo chmod +x kubectl
sudo mv kubectl /usr/local/bin

alt text

  1. Install minikube:
curl -LO https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube && rm minikube-linux-amd64

alt text

  1. Start MiniKube:

alt text

  1. run kubectl webserver
kubectl create deployment webserver --image=nginx:alpine

alt text

alt text

command to delete pod

kubectl delete pod webserver

expose deployment server

kubectl expose deployment webserver --type=LoadBalancer --port=80
service/webserver exposed
kubectl get services

alt text

minikube service webserver --url

alt text

alt text

View minikube dashboard

minikube dashboard

alt text

yash@boi:~$ kubectl get service
NAME         TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
kubernetes   ClusterIP      10.96.0.1       <none>        443/TCP        26m
webserver    LoadBalancer   10.100.82.247   <pending>     80:30934/TCP   15m
yash@boi:~$ kubectl get service webserver
NAME        TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
webserver   LoadBalancer   10.100.82.247   <pending>     80:30934/TCP   15m
yash@boi:~$ kubectl delete service webserver
service "webserver" deleted

alt text