DevSecOps for BBK
  • Introduction
  • Getting Started
    • Virtual Training Practices
    • Training Plan
    • Tools and Configuration
    • Troubleshooting
  • Docker Fundamentals
    • Docker Setup
    • Docker First Container
    • Docker Network Basics
    • Docker Network Exercise
    • Docker Volume Basics
    • Docker Storage
  • Dockerfile Fundamentals
    • Dockerfile Instructions
    • Dockerfile Environment Variables
    • Dockerfile Build Arguments
    • Non-privileged Containers
    • Dockerfile Order of Execution
    • Dockerfile Volume
    • Entrypoint Command
    • Multiple Stage Build
  • Container Management
    • Containers Start Automatically
  • Docker Security
    • Seccomp Profile
  • Docker Compose
    • Docker Compose Install
    • Docker Compose Commands
    • Docker Compose File
    • Docker Compose Volumes and Network
  • K8s Cluster Setup
    • Minikube Installation
    • Calico Networking
    • K8s Walkthrough
    • K8s Cheat Sheet
  • Understand K8s
    • Pod Connectivity
    • Deployments
    • Service Cluster IP
    • Service NodePort
    • ClusterIP Exercise
    • NodePort Exercise
    • Service LoadBalancer
    • Configmap
    • Secrets
  • Application Lifecycle Management
    • Rolling Updates and Rollback
    • Multi Container Pod
  • K8s Storage
    • Persistent Volume
    • Persistent Volume Claim
    • PVC in POD
  • Istio
    • AKS Setup
    • Kubectl Setup in Windows
    • Istio Setup Manual
    • Istio Demo App
    • Istio Observability
  • Terraform
    • Terraform Setup
    • Terraform Demo
    • Azure Terraform Setup
  • Terraform AWS
    • Terraform AWS Setup
    • Terraform AWS Demo S3
  • Refrences
    • Docker Static Site
    • Docker First Image
Powered by GitBook
On this page
  • K8s Setup Requirements
  • Install kubectl
  • Kubectl autocomplete
  • Install Kubernetes using Minikube
  • Start the Cluster
  • Enable Metrics Server
  • Worker Nodes Creation
  • Kubectl context and configuration
  1. K8s Cluster Setup

Minikube Installation

K8s Setup Requirements

  • 8 CPUs or more

  • 16GB of free memory

  • 150 GB of free disk space

  • Internet connection

  • Container or virtual machine manager, such as: Docker, Hyperkit, Hyper-V, KVM, Parallels, Podman, VirtualBox, or VMware Fusion/Workstation

Install kubectl

Download the latest Kubectl release with the command:

curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/bin/

Test to ensure the version you installed is up-to-date:

kubectl version

Kubectl autocomplete

BASH

source <(kubectl completion bash) # setup autocomplete in bash into the current shell, bash-completion package should be installed first.
echo "source <(kubectl completion bash)" >> ~/.bashrc # add autocomplete permanently to your bash shell.

You can also use a shorthand alias for kubectl that also works with completion:

alias k=kubectl
complete -o default -F __start_kubectl k

ZSH

source <(kubectl completion zsh)  # setup autocomplete in zsh into the current shell
echo '[[ $commands[kubectl] ]] && source <(kubectl completion zsh)' >> ~/.zshrc # add autocomplete permanently to your zsh shell

Install Kubernetes using Minikube

To install the latest minikube stable release on x86-64 Linux using Debian package:

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
sudo dpkg -i minikube_latest_amd64.deb

Start the Cluster

Start your minikube cluster with one master node using the following command.

We are using Flannel Plugin for Networking, NetworkPolicy Management, Traffic Management

minikube start
minikube status

Congratulations you now have a minikube cluster.

Enable Metrics Server

minikube addons enable metrics-server

Ensure your Master Node is in Healthy State and all the necessary services and pods are working fine.

Worker Nodes Creation

Note: This as an optional step, you can safely skip this step if you do not require an additional worker node.

minikube node add --worker=true

Now login to the Worker node and then pull all the latest images that are required.

You can use the same script that is used in the Master Server from the above section.

Verify nodes using the following command

kubectl get nodes

Repeat the above steps, if you want to add more worker Nodes.

Kubectl context and configuration

Show Merged kubeconfig settings.

kubectl config view

Display list of contexts

kubectl config get-contexts

PreviousK8s Cluster SetupNextCalico Networking

Last updated 2 years ago