Launching Kubernetes Cluster with Pod

Launching Kubernetes Cluster with Pod

Let's read about minikube and how to implement k8s in our local/cloud machine.

What is minikube?

  1. Minikube is a tool which quickly sets up a local Kubernetes cluster on macOS, Linux, and Windows. It can deploy as a VM, a container, or on bare metal.

  2. Minikube is a paired-down version of Kubernetes that gives you all the benefits of Kubernetes with a lot less effort.

  3. This makes it an interesting option for users who are new to containers, and also for projects in the world of edge computing and the Internet of Things.

Features of minikube

  1. Supports the latest Kubernetes release (+6 previous minor versions)

  2. Cross-platform (Linux, macOS, Windows)

  3. Deploy as a VM, a container, or on bare-metal

  4. Multiple container runtimes (CRI-O, containerd, docker)

  5. Direct API endpoint for blazing-fast image load and build

  6. Advanced features such as LoadBalancer, filesystem mounts, FeatureGates, and network policy

  7. Addons for easily installed Kubernetes applications

  8. Supports common CI environments

Task-01:

Install minikube on your local.

  1. Launch an instance k8s-server with t2.medium instance-type, Ubuntu AMI

    & Connect this instance.

  2. Update the server by using sudo apt-get update command & Install docker by using the sudo apt install docker.io -y command.

  3. Install minikube by using Linux commands such as

    "curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && sudo install minikube-linux-amd64 /usr/local/bin/minikube"

    Run the command "minikube start" to start the cluster. It will surely be getting an error. Hence try "minikube start --driver=docker"

  4. Assign permissions by using sudo usermod -aG docker $USER && newgrp docker and try again for minikube start --driver-dockercommand, then check the running status of minikube by docker ps command.

  5. Now the step for kubectl installation requires running the following

    sudo snap install kubectl --classic command.

Pods

Let's understand the concept of pod

  • Pods are the smallest deployable units of computing that you can create and manage in Kubernetes.

  • 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 & run in a shared context. A Pod models an application-specific "logical host": it contains one or more application containers which are relatively tightly coupled.

Task-02:

Create your first pod on Kubernetes through minikube.

  • Docker, minikube, and kubectl must be pre-installed in the instance.

  • Let's create a pod and run the nodejs-app container in it.

  • Make a directory k8s-projects using mkdir command.

  • Make a pod.yaml by using "vim editor" & create a pod using kubectl apply -f pod.yaml command.

  • View pods by using kubectl get pods command.

  • In addition to this if we wish to check the running status of the container inside the instance it is not possible because the pod is only meant for running containers not for mapping a port.

  • If we enter inside the minikube cluster by using minikube ssh command, we come inside docker where we can view the container functioning at PrivateIP:containerPort by using curl like below:

References:

Installation of minikube

Concept of pods


Thanks for reading my blogs. Hope it helps.

Keep motivating me with your feedback and comments.

Keep hustling and keep upskilling.