Launching your First Kubernetes Cluster with Nginx running

Launching your First Kubernetes Cluster with Nginx running

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.

  • 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

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, 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.

Install minikube on your local

  1. When creating a new EC2 instance select t2.medium.

  2. Install Docker in your system.

 sudo apt update -y
 sudo apt install docker.io -y

 sudo systemctl start docker
 sudo systemctl enable docker
 sudo systemctl status docker
  1. Add the user to the docker group
 sudo usermod -aG docker $USER && newgrp docker
  1. Install Minikube in the system.

      curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
    
      sudo install minikube-linux-amd64 /usr/local/bin/minikube
    
  2. And then install Kubelet.

      sudo install kubectl --classic
    
  3. Start Minikube

      minikube start --driver=docker
    
  4. Check if Minikube has been set up successfully or not by checking pods or namespace.

      kubectl get pods
    
      kubectl get namespace
    

Creating Your First Pod on Kubernetes through Minikube

 apiVersion: v1
 kind: Pod
 metadata:
   name: nginx
 spec:
   containers:
   - name: nginx
     image: nginx:1.14.2
     ports:
     - containerPort: 80