Sunday 6 October 2019

kubernetes(Minikube) on Ubuntu 18.4

                      
What is Minikube: Minikube is the Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a single-node Kubernetes cluster inside a Virtual Machine (VM) on your laptop for users looking to try out Kubernetes or develop with it day-to-day.

Lets understand basic pieces of Minikube/Kubernets before start:
  • Container – In Minikube, containers are used as the building blocks of creating applications.
  • Pod – Pod is a collection of one or more containers that share storage and network resources. Pods contain the definition of how the containers should be run in Minikube. Minikube uses these definitions to maintain the necessary resources. For example, you can define you need two pods. During execution, if one pod goes down, Minikube will automatically fire up a new pod.
  • Service – Because pods are replaceable, Minikube needs an abstraction layer to keep the interaction between the different pods seamless. For example, if a pod dies and a new pod is created, the application users shouldn’t get impacted in the details of network addresses and related issues. Services are wrappers around the pods to create levels of abstraction.
  • Master – Master coordinates the cluster. It’s like the brains of the operation.
  • Node – Workers who run the pods.
  • kubectl – It’s the command line interface for running commands on Kubernetes cluster.
Step 1: Run update on system
sudo apt update

Step 2: Install supporting packages
sudo apt-get install -y apt-transport-https

Step 3: Install virualbox for virtulization
sudo apt-get install -y virtualbox virtualbox-ext-pack

Step 4: Install latest version of  Minicuke
sudo wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo chmod +x minikube-linux-amd64
sudo mv minikube-linux-amd64 /usr/local/bin/minikube

Step 5: Start minikube
sudo minikube start --vm-driver=none

Step 6: Verify Minikube installation
sudo minikube version
sudo minikube status
Step 7: Now Install Cubectl
sudo curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo echo "deb [arch=amd64 allow-insecure=yes allow-downgrade-to-insecure=yes] http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt update
sudo apt -y install kubectl

Step 8: Verify Kubectl installation
sudo kubectl version -o json

Step 9: Access Expose Minikube dashboard to access it
sudo minikube dashboard --url      # This will generate url to access with web browser

Some other useful commands:
kubectl get pods --all-namespaces
minikube stop
minikube addons list
minikube ssh
kubectl get nodes
kubectl cluster-info
minikube delete