what is a namespace

Namespaces are virtual clusters backed by the same physical cluster. Kubernetes objects like pods and containers live in namespaces, essentially a namespaces is a way to organize objects in your kubernetes cluster

Namespaces is a very useful tool if you have many different type of applications running or if you have multiple teams that share the cluster.

working with namespaces

$ kubectl get namespaces
default Active 21h
kube-node-lease Active 21h
kube-public Active 21h
kube-system Active 21h

All Kubernetes clusters have a default namespace. This is used when no other namespace is defined.

kubeadm also creates the kube-system…

Photo by Lance Anderson on Unsplash

stdin,stdout and stderr

When bash starts creates three file descriptors, these file descriptors point not to a file but in a terminal device usually in the format of /dev/tty[n]

stdin: file descriptor 0, stdin stands for standard input and means incoming to the terminal data, the standard device to enter data to the terminal is the keyboard.

stdout: file descriptor 1, stdout stands for standard output and means printing to the terminal normal messages, or text.

stderr: file descriptor 2, stderr stands for standard error and means printing error messages to the terminal.

redirecting output

The stdout and stderr can redirected to a file if…

This tutorial has been tested with an ubuntu 18.04 distribution and its purpose is to create a controller host and any number of worker hosts.

The bellow steps must executed to all hosts of the cluster


We will use containerd as CRI runtime, this means that we need to enable and load some kernel modules and do some network configuration changes as well.

Execute the following as root or with sudo

cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf overlay br_netfilter EOF sudo modprobe overlay sudo modprobe br_netfilter # Setup required sysctl params, these persist across reboots. cat <<EOF | sudo tee…

What are and/or/no-care chains?

and/or/no-care chains are bash syntactic sugar that allows users to execute a chain of commands and decide which command to be executed on this chain based on the exit code of the previous command.


Linux has a command named true its usage is very simple to understand, it exists with exit code 0 and this can be verified with the $? variable which holds the exit code of the last executed command.

kpatronas@narcissus:~$ true
kpatronas@narcissus:~$ echo $?

As you can guess there is also the false command that exits always with exit code 1

kpatronas@narcissus:~$ false kpatronas@narcissus:~$ echo…

Kubernetes is composed by a set of processes running on machines of a network that can communicate each other, those processes can divided into two categories, the control plane processes and ne node processes

Kubernetes Control Plane

The control plane is a collection of software components that manage the cluster, these components can run to any machine of the cluster but usually are run on dedicated controller machines.

Control Plane Architecture
  • kube-api-server this process exposes the Kubernetes API, which is the interface to the control plane and the cluster.
  • Etcd is a key/value database which Kubernetes API uses to keep the configuration and…

grep is the standard unix tool to filter text files and will remain the standard tool because of its speed and many examples available online, but grep its not well suited to parse JSON because it doesnt do any filtering between key and values of JSON. But there is a nice solution to parse and filter JSON, its called jq.

Example: How to read JSON input

jq can be used to read JSON output from another process like curl or provide a file name to parse

Example: reading input from another process and from a file

Example: print the full JSON pretty printed.

The “.” expression means print all key-values…

YAML Dictionary

key: value


Property1: Value1

YAML Dictionary in Dictionary

property1: value1
property2: value2
property3: value3


name: kostas
gender: male
age: 39

YAML List example

Ansible can execute commands in Linux hosts using ssh, powershell in Windows hosts and just plain bash commands when interacting with the localhost and don't want to use a remote protocol.

We can define what protocol to use along some other options specific to the hosts in the inventory file, lets see an example

nginx1 ansible_host=nginx1.example.com ansible_connection=ssh
db1 ansible_host=db1.example.com ansible_connection=winrm
ansible_master ansible_host=localhost ansible_connection=local

ansible_host must point to the real hostname or ip address of the host, also hosts can have an alias in order to avoid long or complicated hostnames, nginx1 is the alias for nginx1.example.com


Ansible is not usefull only to run large complicated playbooks, its also usefull when you want to run simple commands on group of servers.

In this scenario we have a group of two servers named web1 and web2, and they are grouped into the [webservers] section of our inventory.


The goal is to create on each server a user named webops, create a directory that will hold the ssh key for this user and finally copy the key to web1 and web2, Finnaly we will verify that nginx is set to start on boot.

Create users


In this article i will show you how to install and configure ansible and how to run a basic playbook.

We have two computers, the control computer and the target computer. The control computer will be used to install ansible and run all ansible commands from there.

The target computer will be used as a remote computer that we want to execute commands through ansible.

I assume that both computers run Centos 7.

Install Ansible on control computer

Type the following on control computer, those commands will install the epel repository and ansible its self.

$ su - root #…

Konstantinos Patronas

DevOps engineer, loves Linux, Python, cats and Amiga computers

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store