Kubernetes Overview(CKA Preparation)

Featured

Table of contents

  1. Kubernetes Architecture:
    1. kubernetes components
    2. ETCD
    3. Process Flow of a PODย creation:
  2. Kubernetes Deployment
  3. Kubernetes Services
  4. Kubernetes Scheduler
    1. Labels and selectors:
    2. Annotations:
    3. Taints and Toleration: (It’s more specific to node)
    4. Node Selector: (To host Pod on particular node)
    5. Node Affinity: ( to host pod on conditional based node)
    6. Additional Info: Assigning Pods to Nodes
    7. Resource limit & Request:
  5. Configure Application:
    1. Environment Variables for a Container:
    2. ConfigMap:
    3. Secrets
    4. Multi container
  6. Cluster upgrade
    1. Cluster upgrade details
    2. ETCD backup and restore
  7. API Groups in Kubernetes
    1. Core group
    2. Named group
  8. RBAC:
    1. Roles and clusterRole:
    2. Examples:
  9. Storage
    1. Direct Provisioning
    2. Staticย provisioning
    3. Dynamic provisioning
    4. StorageClass
    5. Volume Expansion
  10. Network policy
    1. Example:
  11. Ingress Controller
  12. JsonPath
  13. Troubleshooting
    1. Applications failures
    2. Control-plane failures
    3. Worker-nodes failures:
    4. Network issues
1)cluster Architecture Installation and configuration: 25%
  - installation
  - RBAC
  - etcd backup
  - static pod 
2)Workloads & scheduling: 15%
  - Pod,deployment,RS,how to scale them.
  - secret,configmap.
  - multiple containers.
  - request/resource limit.
  - sidecar containers
3)services and networking: 20%
  - types of services
  - ingress
  - network policies
  - coreDNS
4)Storage: 10%
  - storageclass
  - Persistenet volume.
  - Persistent volume claim.
  - Storageclass and dynamic. 
5)Troubleshooting: 30%
  - what if a node is not ready ?
  - what if a pod is frequently restarting ?
  - what if all CPU resource is used up and you need to find out which pod consumes the most and why ?
  - How to monitor certain resources?
  - troubleshoot the failed components.
K8S Architecture

Kubernetes Architecture:

kubernetes components

Master Components:
ETCD: which stores information about cluster.
Kube-scheduler: responsible for scheduling application or containers on nodes.
Controllers: Node controllers,Replication controllers etc
kube-API: responsible for manages operations.
worker Components:
Kubelet: That listen instruction from kube-api servers and manages container.
kube-proxy: Enable communication between services with clusters.

Ports and Protocols:

K8s Master ports and protocols
k8s worker node port and protocols
  • Kubernetes is open source system for automating deployment,scaling and management of containerized applications.
  • New kubernetes version are released in 3 month cycles.
Continue reading “Kubernetes Overview(CKA Preparation)” →

F5 loadbalancer data pull using bash script

If we need to pull the pool and virtual service data or the search and find the IP/hostname of any node

++++++++++++++++++++++++++++++++++++++++
LB COMMANDLINE BASH RESTAPI PULL DATA

NOTE: PRERQUISTE: INSTALL jq & UPDATE THE LB CREDENTIALS 

./F5_load_balancer_read_pull.sh <LBIP>  [vs|pool|vs|vspool|pnode|pnoded|pnodee|pip|pname]

 1. LIST THE VIRTUAL SERVICE OR VIP
	./F5_load_balancer_read_pull.sh LBIP vs [list]
		 ex: ./F5_load_balancer_read_pull.sh F5-LBIP-IP vs list

 2. LIST THE ALL POOL LIST
	./F5_load_balancer_read_pull.sh LBIP pool list
		 ex: ./F5_load_balancer_read_pull.sh F5-LBIP-IP pool list

 3. TO LIST THE VIP AND POOL WITH VIP IP ADRRESS
	./F5_load_balancer_read_pull.sh LBIP vspool
		 ex: ./F5_load_balancer_read_pull.sh F5-LBIP-IP vspool

 4. TO LIST THE SERVER/NODE FROM POOL
	./F5_load_balancer_read_pull.sh LBIP pnode <poolname>
		 ex: ./F5_load_balancer_read_pull.sh F5-LBIP-IP pnode POOL_NAME

 5. TO LIST ONLY THE DISABLED NODE FROM POOL
	./F5_load_balancer_read_pull.sh LBIP pnoded <poolname>
		 ex: ./F5_load_balancer_read_pull.sh F5-LBIP-IP pnoded POOL_NAME

 6. TO LIST ONLY THE ENABLED NODE FROM POOL
	./F5_load_balancer_read_pull.sh LBIP pnodee <poolname>
		 ex: ./F5_load_balancer_read_pull.sh F5-LBIP-IP pnodee POOL_NAME

 7. SEARCH THE NODE WITH IP ADDRESS IN THE LB
	./F5_load_balancer_read_pull.sh LBIP ip <ip_address>
		 ex: ./F5_load_balancer_read_pull.sh F5-LBIP-IP ip X.X.X.X

 8. SEARCH THE NODE WITH HOSTNAME IN THE LB
	./F5_load_balancer_read_pull.sh LBIP name <hostname>
		 ex: ./F5_load_balancer_read_pull.sh F5-LBIP-IP name hostname

 9. FIND IP ADDRESS FROM WHICH POOL IT BELOWS TO
	./F5_load_balancer_read_pull.sh DCIP pip <ip_address>
		 ex: ./F5_load_balancer_read_pull.sh F5-LBIP-IP pip X.X.X.X

 10. FIND HOSTNAME FROM WHICH POOL IT BELOWS TO
	./F5_load_balancer_read_pull.sh DCIP pname <hostname>
		 ex: ./F5_load_balancer_read_pull.sh F5-LBIP-IP pname demo

GIT REPO: https://github.com/rupin147/F5-loadbalancer-data-pull-bash-script

Bash Script | Find/grep keyword from docs(MS document file) | without any additional installation | linux

A task where we can pull the data from the doc file which match the string from file and get the count of it .

In below screenshot, contain the string/keyword that we need to search/grep from doc file.

grep the matching string from doc file

command:

 while read -r line; do  ; unzip -p 12_karela_jamun_juice_for_Seniors.docx | grep '<w:t' | sed 's/<[^<]*>//g'  | grep -io $line  | wc -l | xargs echo $line: ; done < searchfile.txt
grep the file string/keyword that match in doc file

Setup simple kubernetes on AWS | System Administrator

Installing Kubernetes on AWS

What is Kubernetes / K8s?

The name Kubernetes originates from Greek, meaning โ€œhelmsmanโ€ or โ€œpilotโ€, and is the root of โ€œgovernorโ€ and โ€œcyberneticโ€. The Kubernetes is an open-source project started by Google in 2014. It helps in automating deployment, scaling and operations of application containers across clusters of hosts.

Amazon Web Services (AWS) recently introduced a managed Kubernetes service called EKS. Nevertheless, itโ€™s still under preview mode. Therefore, at the moment Kubernetes can be installed on AWS as explained in the Kubernetes documentation either using conjure-up, Kubernetes Operations (kops), CoreOS Tectonic or kube-aws. 

Continue reading “Setup simple kubernetes on AWS | System Administrator” →

Linux Troubleshooting Basics |System Administrator

Basic Health Checks:

CPU Usage:

  • When applications are running slow, the first thing you should check is whether the system is in fact busy doing anything. The quickest way to find out is via the uptime/w
    command,
  • This command prints a short overview of the system status, including the current time, the amount of time the system has been on (or up), the number of logged-in users, and
    three numbers representing the systemโ€™s workload.
  • The system load is displayed in three numbers. These numbers form an index that indicates the average ratio of work scheduled to be done by a CPU versus the work actually
    being done, over the past 1-minute, 5-minute, and 15-minute periods.
  • A load of 1.00 means the amount of work being scheduled is identical to the amount of work a CPU can handle. Confusingly, if a host contains multiple CPUs, the load for each
    CPU is added to create a total; on a host with four CPU cores, a load of 4.00 means the same as a load of 1.00 on a single-core system.
  • itโ€™s possible that a process is waiting for the host to perform a task that cannot be interrupted, such as moving data to or from disk. If this task must be completed before
    the process can continue, the process is said to be in uninterruptible sleep. It will count toward a higher load average but wonโ€™t actually be using the CPU.
  • A fork bomb creates new copies of itself as fast as the host will allow. One process creates two, two create two more, four leads to eight, and so on, thus starving other
    processes of resources such as CPU cycles and, eventually, RAM.
Continue reading “Linux Troubleshooting Basics |System Administrator” →

Linux Terminal Color shifting bash prompt based on exit code | System Administrator

Most of us work with a shell prompt. By default most, Linux distro displays hostname and current working directory. But only a few may be knowing about customizing the Bash prompt.

You can view the current Bash Prompt status by running this command below:

# echo $PS1
[\u@\h \W]\

Modifying the Bash prompt

The bash prompt is controlled by a variable named PS1, and we can adjust this variable in your .bashrc file to customize your prompt.In addition, if you want to make these changes available for all system users on the system or globally, all you need to do is modify this variable in the /etc/bash.bashrc file (on Debian and Ubuntu systems) or /etc/bashrc (on other Linux distributions) instead of ~/.bashrc.

Continue reading “Linux Terminal Color shifting bash prompt based on exit code | System Administrator” →

Multiwan(Dual/Multi ISP) setup in linux for VM hosts | System Administrator


The multi-WAN feature allows you to connect your system to multiple Internet connections. Multi-WAN not only provides load balancing, but also automatic failover.
Multi-WAN has the following features:
+ auto-failover.
+ load balanced.
+ round-robin based on user-defined weights.
To give you an example of how multi-WAN works, imagine two 1 Mbit/s DSL lines with two users on the local network. With every new connection to a server on the Internet, the multi-WAN system alternates WAN interfaces. User A could be downloading a large file through WAN #1, while User B is making a voice-over-IP (VoIP) telephone call on WAN #2.
Bandwidth is distributed on a per-connection level. This means that you will not see the aggregated bandwidth on any particular download or speed benchmark, but you will see the benefits when multiple data transfers are occurring simultaneously, for example, when several individuals in your household are streaming movies. In addition, multi-connection file transfer protocols such as BitTorrent, will see the benefits of the load balancing.
Configuration:
Multi-WAN weights are used to load balance outbound Internet traffic. By default, all WAN interfaces are given a weight of one. This default configuration means the network traffic will be roughly evenly split amongst the different WAN connections. In one of the typical multi-WAN configurations, a second broadband connection is used for backup. This second connection is often a low-cost and low-bandwidth connection. In this case, you would want to set the weight on your high-bandwidth connection to 3 or 4, while leaving your low-cost/low-end connection with a weight of 1. The calculation for amount of bandwidth for a certain NIC is the weight of that NIC over the sum of all NICs. For example, if I have 3 external multi-WAN NICs eth0, eth1, and eth2 and the weight is 4, 3, and 1 respectively. This will mean that the bandwidth will be divided as such

NICWeightFractionPercentage
eth044/850%
eth133/837.5%
eth211/812.5%
TOTAL8
Continue reading “Multiwan(Dual/Multi ISP) setup in linux for VM hosts | System Administrator” →

How can I mount a disk image locally? | Linux System Administrator

The kpartx tool makes this easier. It creates loop devices in /dev/mapper for each partition in your image. Then you can mount the loop device that corresponds with your desired partition without having to calculate the offset manually.

For example, to mount the first partition of the disk image:

kpartx -a -v myimage.disk
mount /dev/mapper/loop0p1 /mnt/myimage

When you’re done with the image, remove the loop devices:

umount /mnt/myimage
kpartx -d -v myimage.disk

root@ubuntu:~# mkdir /mnt/myimage
root@ubuntu:~# mount /dev/mapper/loop0p1 /mnt/myimage
mount: /dev/mapper/loop0p1 is write-protected, mounting read-only
root@ubuntu:~# cd /mnt/myimage
root@ubuntu:/mnt/myimage# ls -lrth
total 82K
-r–r–r– 1 root root 1.7K Nov 27 2013 RPM-GPG-KEY-CentOS-Testing-6
-r–r–r– 1 root root 1.7K Nov 27 2013 RPM-GPG-KEY-CentOS-Security-6
-r–r–r– 1 root root 1.7K Nov 27 2013 RPM-GPG-KEY-CentOS-Debug-6
-r–r–r– 1 root root 1.7K Nov 27 2013 RPM-GPG-KEY-CentOS-6
-r–r–r– 1 root root 18K Nov 27 2013 GPL
-r–r–r– 1 root root 212 Nov 27 2013 EULA
-r–r–r– 1 root root 1.4K Mar 28 2017 RELEASE-NOTES-en-US.html
-r–r–r– 1 root root 14 Mar 28 2017 CentOS_BuildTag
dr-xr-xr-x 2 root root 2.0K Mar 28 2017 isolinux
dr-xr-xr-x 3 root root 2.0K Mar 28 2017 EFI
dr-xr-xr-x 2 root root 40K Mar 29 2017 Packages
-r–r–r– 1 root root 3.4K Mar 29 2017 TRANS.TBL
dr-xr-xr-x 2 root root 4.0K Mar 29 2017 repodata
dr-xr-xr-x 3 root root 2.0K Mar 29 2017 images
root@ubuntu:/mnt/myimage#


Continue reading “How can I mount a disk image locally? | Linux System Administrator” →