#90daysofdevopschallenge
#day31
Kubernetes basics: devunnatig.hashnode.dev/kubernetes-overview..
What is minikube?
Minikube is a tool that quickly sets up a local Kubernetes cluster on macOS, Linux, and Windows. It can deploy as a VM, a container, or on bare metal.
Minikube is a pared-down version of Kubernetes that gives you all the benefits of Kubernetes with a lot less effort.
Minikube is a single-node cluster that is built on one machine only - a containerized machine or a virtualized machine.
Running minikube on a single node requires 2 CPU.
Note: if you prefer AWS Cloud Provider please go with t2.medium because t2.micro has 1 CPU.
Features of minikube
(a) Supports the latest Kubernetes release (+6 previous minor versions)
(b) You can install minikube on Windows, macOS, and Linux machines.
(c) Deploy as a VM, a container, or on bare-metal
(d) Multiple container runtimes (CRI-O, containerd, docker)
(e) Direct API endpoint for blazing-fast image load and build
(f) It provides features such as a Load Balancer, filesystem mounts, Feature Gates, and network policy
(g) Addons for easily installed Kubernetes applications
(h) Supports common CI environments
❄Tasks
1. Install minikube on your local.
Here, Using AWS EC2 instance to install minikube.
Assuming the AWS EC2 instance is created with t2.medium and access that instance by using SSH.
Step 1: For installation of minikube, follow the official website of minikube.
Minikube official website link: minikube.sigs.k8s.io/docs/start
Step 2: Copy the command on step 1 and paste it on your ec2-instance.
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
Step 3: Now install docker or any other driver like (kvm2, podman, qemu2, or VirtualBox) to start the service of minkube and give some required permission to docker.
sudo apt-get install docker.io
sudo usermod -aG docker $USER
chmod 777 /var/run/docker.sock
Step 4: Start the minikube service and install kubectl.
minikube start --driver=docker
sudo snap install kubectl
Congratulations! Successfully installed minkube.
Note: If you don't know about the kubectl tool in K8S. Please go through this article:
devunnatig.hashnode.dev/kubernetes-overview..
What is a pod?
Pods are the smallest deployable units of computing that you can create and manage in Kubernetes. Inside the pod, our application container is present.
In one pod, there may be multiple containers running, or maybe one container is running.
A Pod (as in a pod of whales or pea pod) is a group of one or more containers, with shared storage and network resources, and a specification for how to run the containers. A Pod's contents are always co-located and co-scheduled, and run in a shared context. A Pod models an application-specific "logical host": it contains one or more application containers that are relatively tightly coupled.
2.Create your first pod on Kubernetes through minikube.
Here Create a pod for Prometheus by using the Prometheus image.
By using the command:
Step 1: Create pods by using the kubectl run command.
kubectl run prometheus --image=prom/prometheus
Step 2: Check pod is running by using the kubectl get command.
kubectl get pods
By using yaml file:
Step 1: Using vi-editor to write the pod.yaml file.
vi pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: prometheus-pod
spec:
containers:
- name: prometheus-pod
image: prom/prometheus
Step 2: Apply this file by using the kubectl apply command.
kubectl apply -f pod.yaml
kubectl get pods
Congratulations! Successfully created your first pod on Kubernetes Cluster.
In the Next Article, we will go deep down in K8S Deployments.......
Thank you for giving your precious time to read this blog/article and if any suggestions or improvements are required on my blogs feel free to connect on LinkedIn Unnati Gupta. Happy Learning !!!