K8s Hands-on - 2


Reference file for dashboard.yaml https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml
Similar file, is present at Katacoda course

Each worker node has Kubelet. cAdvisor (port 4194) is part of Kubelet binary. It collects following data for node, pods and containers. 
- CPU usage
- Memory usage
- File system
- Network usage

Heapster collect / aggregate all the above data from cAdvisor over REST API. Heapster store this data to InfluxDB. Grafana access the data from InfluxDB and visulaise 

Heapster cal also store data in Google Cloud Monitoring service. Then Google Cloud Monitoring Console can access this data and visualize it. 


Horizontal scaling is possible with below command

kubectl scale --replicas=3 deployment x

Few more useful alias

alias kc='kubectl create'
alias kd='kubectl delete'
alias ka='kubectl apply'

Deployment can be store mannually as YAML file and created back again using that YAML file. 

kg deployment x -o yaml
k delete svc x
k delete deployment x

k create -f x.yaml
kubectl expose deployment x --port=80 --type=NodePort

Same applies for service

kg svc x -o yaml
kd svc x
kc -f x_svc.xml

Remove undwanted lines and change replicas value. 
ka -f x.yaml

Guestbook example

kc -f redis_m_controller.yaml 
kg rc

Same example https://kubernetes.io/docs/tutorials/stateless-application/guestbook/ So related YAML files are also similar. E.g.

redis-master-controller.yaml is same as 

redis-master-.yaml is same as 

Same for redis-slave and PHP frontend. 
To see log from any pod

k logs -f POD_NAME

K8s Hands-on - 1

One can find many useful articles about basic kubectl commands and minikube. Katacoda is one of the best website, for online hands-on with k8s. Here, I just shared my experience with katacoda and on-premise minikube cluster. 

First, one need set few alias at .bashrc file. 

alias k=kubectl
alias kg=kubectl get
alias m=minikube


By default, minikube runs with 2 CPUs and 2GB RAM. It makes the system slow. minikube needs minimum 2 CPU. With trial and error i found, 1.5 GB is sufficient to run minikube. 

minikube start --memory 1536

Now few commands

kubectl config view
kubectl cluster-info
kubectl get nodes
kubectl desscribe node

minikube ip
minikube dashboard
minikube addons enable heapster
minikube addons list
minikube service list
minikube status

Service related commands

One can use svc in place of service for kubectl command, not for minikube commands

kubectl get svc 
command lists services only from default namespace, while
minikube service list 
command list services from all namespace. 
One can add "-n kube-system" for kubectl command. 
kubectl get svc -n kube-system
One can also add "--all-namespaces" for kubectl command
kubectl get svc --all-namespaces

Virtual Box

/home folder of host OS is mounted as /hosthome folder inside VirtualBox

To login to virtual box
minikube ssh
ssh to minikube's IP address with docker/tcuser
Note: None of the above methods work at Katacoda for first scenario "Launching single Node cluster" under "Introduction to Kubernets" hands-on.

Here are comparision of IP address and various interface within virtual box and outside virtual box

IP Address Interface Interface IP Address Remarks
Outside VBox Outside VBox Inside VBox Inside VBox docker0 docker0 Pod network vboxnet0 eth1 Minikube IP address

eth0 Node Internal IP lo lo Local interface


I found, below 3 basic images to begin with

kubectl create deployment x --image=katacoda/docker-http-server
kubectl create deployment k --image=k8s.gcr.io/echoserver:1.10

kubectl create deployment i --image=nginx

The dployment should be exposed with below commans
For http-server and nginx
kubectl expose deployment x --port=80 --type=NodePort
kubectl expose deployment i --port=80 --type=NodePort
For echo-server

kubectl expose deployment k --port=8080 --type=NodePort

The deployment can be removed with

kubectl delete svc
kubectl delete deployment

Access Service

As per katacoda, the service can be tested with curl command as below

export PORT=$(kubectl get svc first-deployment -o go-template='{{range.spec.ports}}{{if .nodePort}}{{.nodePort}}{{"\n"}}{{end}}{{end}}')

echo "Accessing host01:$PORT"

curl host01:$PORT

There are alternate ways also


curl $(minikube service x --url) 

3. The below command invoke browser with required URL

minikube service x

4. Using proxy

kubectl proxy

Open URL in browser 


To get details about pod in JSON format

kubectl get pods -o json


kubectl proxy

Open URL in browser 

To login to pod

kubectl exec -it $POD_NAME bash

To get enviornment variables

kubectl exec $POD_NMAE env


Reference file for dashboard.yaml https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml
Similar file, is present at Katacoda course

Dockercon 2019 SFO Recap & Announcements

This blog is just about key takeaway points from a Meetup Event : https://www.meetup.com/Docker-Bangalore/events/261474778/




1. Dockercon 19 Recap & Announcement by 

Ajeet Singh Raina https://www.linkedin.com/in/ajeetsraina/

Importanat playlists

Docker Labs : https://github.com/collabnix/dockerlabs DockerLabs brings you tutorials that help you get hands-on experience using Docker & Kubernetes.

Ajeet discussed about Docker desktop enterprise and its feature application designer. Version Packs is used for backward compatibility.  https://blog.docker.com/2019/05/a-first-look-at-docker-desktop-enterprise/

"docker buildx" is useful to build Docker container image for various on-premises and cloud platform in one shot. At present, available only in enterprise version. 

One interesting webinar : "How Docker Simplifies Kubernetes for the Masses"


2. Hardening and Securing your Kubernetes Platform – Munish Kumar Gupta

cAdvisor, is agent running at worker node, which collect usage information. It is not secure. As part of hardening, it is disabled. 

One should refer : Docker file best practicies https://docs.docker.com/develop/develop-images/dockerfile_best-practices/

Important resources about security : Center for Internet Security (CIS)

If master node comes down, then also the application will be keep running. Yes, during deployment if master node come down then deployment got impacted. 

We should sepeate network for control plane (between master node, worker nodes) and user plane (for pod to pod communication among microservices)

We should have pod restart policy and health check API in plact at pod. 

Munish kept camera icon on right top cornet to indicate picture time. Instead of taking notes, one can take picture of that important slide. 

Generally at VISA deployment the VMs are run with 30 to 40 % of capacity. Containers run with higher capacity. 



3. Next Gen Payments Platform For Evolving Digital Economy – Sachin Karjatkar & Prabhu Kadapenthangal Venkatesan


4. Sentiment Analysis using Stanford NLP , Docker , Helidon Microservice - Saiyam Pathak

DockerHub can pull DOCKERFILE from github and build Docker container image with appropriate config settings at DockerHub website. 

Saiyam's suggested to use his github repository for K8s autoscaller components. https://github.com/saiyam1814/autoscaler 
It is based on K8s git hub repository https://github.com/kubernetes/autoscaler

Helidon is a collection of Java libraries for writing microservices that run on a fast web core powered by Netty. https://helidon.io

Torando is a Python web framework and asynchronous networking library, https://www.tornadoweb.org


Nginx is a web server which can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache.

Want to port forward a resource:
kubectl port-forward TYPE/NAME [LOCAL_PORT:]REMOTE_PORT
kubectl  port-forward deployment/saiyam 8081:8080


5. Running Docker containers on IoT - Sangam Biradar

Docker repository for Raspberry Pi https://hub.docker.com/u/arm32v7


Consonants of Bhagavad Gita Text

Consonants of Bhagavad Gita Text


Sanskrit language’s alphabet is very scientific. All the consonants are divided in different classes. The different sounds made by birds is represented by class consonants (, , , , ङ) , amphibians (e.f. frog) sounds in class ट (ट, , , , ण ), mammals (e.g. sheep, goat, cows etc.) sounds by class (, , , , ) and all the divine prayers, mantras always contain at least one consonant from unclassified category (, , , , , , , , , , ,) . Thus, the alphabet sequence of Sanskrit (and most of the Indian languages) indicates evolution.

Here, an attempt is made to understand, the usage of consonants in holy Hindu scripture Shrimad Bhagavad Gita, using Python code.


·         Shrimad Bhagavad Gita text file is loaded in Python code. This input file is UTF-8 format Unicode text.
·   From the input files, 37 consonants are identified. Their Unicode is 0xE0A495 for , to 0xE0A4BA for .
·         The dictionary data structure is used, to associate all the consonants with different consonant classes and with different speakers. For source code, please refer https://github.com/mpanchmatia/BhagavadGitaAlphabet

Some important findings

·         Shrimad Bhagavad Gita contains total 30271 consonants. The Devanagari (Hindi) script has total 37 unique Unicodes for consonants.
·         Out of these 30271 constantans, majority of consonants 40.22 % used in Shrimad Bhagavad Gita are belongs to unclassified category. The least contribution 2.15 % is from class ट. Here is the detail breakup.

Consonant class
, , , ,
6.99 %
, , , ,
5.77 %
, , , ,
2.15 %
, , , , ,
28.45 %
, , , ,
16.43 %
, , , , , , , , , , ,
40.22 %
100 %

·         The least one is  pronounced only for once by the lord Krishna.
·         The most frequent consonants uttered is , 3931 times and 
·         Out of these 30271 constantans, majority of consonants 80.37% of consonants are uttered by the lord Krishna and 13.39 % of constantans are uttered by Arjuna. Here is the detail breakup.

Number of consonants
Percentage of consonants
13.39 %
the lord Krishna
80.37 %
5.72 %
0.14 %
0.39 %
100 %

Please refer https://github.com/mpanchmatia/BhagavadGitaAlphabet/blob/master/output.txt for deatil break-up of all consonants uttered by all characters. 

Future Scope

·         The scope of consonants analysis can be further extended, like, identify patterns that can be corelated to energy movement in the body and impact on brain from neuroscience perspective.

·         The analysis can be done to other ancient Sanskrit text, epic, hymns etc.

·         One can target famous text from other languages also and perform comparative analysis.