Skip to main content

Command Palette

Search for a command to run...

Launching your First Kubernetes Cluster with Nginx running

Updated
3 min read
Launching your First Kubernetes Cluster with Nginx running
U

👨‍💻 DevOps Architect @ Hippo Technik, LLC Passionate about bridging the gap between development and operations, I'm a dedicated DevOps Engineer at 6D Technology. With a strong belief in the power of automation, continuous integration, and continuous delivery, I thrive in optimizing software development pipelines for efficiency and reliability. 🚀 Exploring the DevOps Universe In my articles, I delve into the fascinating world of DevOps, where I share insights, best practices, and real-world experiences. From containerization and orchestration to CI/CD pipelines and infrastructure as code, I'm here to demystify the complex and empower fellow developers and ops enthusiasts. 📝 Blogging for Knowledge Sharing As a tech enthusiast and a lifelong learner, I'm committed to sharing knowledge. My articles aim to simplify complex concepts and provide practical tips that help teams and individuals streamline their software delivery processes. 🌐 Connect with Me Let's connect and explore the ever-evolving landscape of DevOps together. Feel free to reach out, comment, or share your thoughts on my articles. Together, we can foster a culture of collaboration and innovation in the DevOps community. 🔗 Social Links LinkedIn: https://www.linkedin.com/in/unnati-gupta-%F0%9F%87%AE%F0%9F%87%B3-a62563183/ GitHub: https://github.com/DevUnnati 📩 Contact Have questions or looking to collaborate? You can reach me at unnatigupta527@gmail.com Happy Learning!!

#90daysofdevopschallenge

#day31

Kubernetes basics: https://devunnatig.hashnode.dev/kubernetes-overview-architecture

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: https://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:

https://devunnatig.hashnode.dev/kubernetes-overview-architecture

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 !!!

More from this blog

D

DevOps Dynamics

44 posts

Hello, fellow tech enthusiasts! I'm Unnati Gupta, and I'm delighted to welcome you to my corner of the internet. My journey in the tech realm has been nothing short of exhilarating.