Kubectl: Create Deployment – Command Line

In this note i will show how to create a Deployment from the command line using the kubectl command.

Below you will find the examples of how to deploy an Nginx Docker image on a Kubernetes cluster and how to update and scale it using the kubectl command only (without YAML configs).

I will also show how to create a Service to expose the created Deployment outside the Kubernetes cluster. (more…)

Kubectl: Get Deployments – Kubernetes

A Deployment in Kubernetes is the process of providing declarative updates to Pods.

It allows to declare the desired state in the manifest (YAML) file, and the controller will change the current state to the declared state.

Deployments can scale the number of replica Pods, enable rollout of updated code in a controlled manner, or rollback to an earlier Deployment version if necessary.

This note shows how to get the list of Deployments in Kubernetes, how to Describe deployments and how to get the Deployment details in YAML format using the kubectl command. (more…)

Kubectl: Get Services – Kubernetes

In Kubernetes, a Service is an abstraction which represents a logical set of Pods and a policy by which to access them.

Although each Pod has a unique IP address, those IPs are not exposed outside the cluster without a Service.

The point is that Pods in Kubernetes are “mortal” – every time a Pod dies for some reason, a new Pod is created in its place with a different IP address, so IP addresses of Pods cannot be called persistent and stable.

The idea of a Service is to group a set of Pod endpoints (back-end) into a single resource (front-end) with a persistent IP addresses that can be exposed in different ways depending on a ServiceType.

In this note i will show how to list Services in Kubernetes using the kubectl command and how to get detailed information about each Service in different formats. (more…)

Kubectl: List & Change Namespaces – Kubernetes

Kubernetes supports multiple virtual clusters backed by the same physical cluster.

These virtual clusters in Kubernetes are called Namespaces.

The Namespaces allow to partition physical resources into the logically named groups, allowing a Kubernetes cluster to share resources between multiple groups.

In this note i will show how to get the current Namespace, list all Namespaces and switch between Namespaces in Kubernetes cluster using the kubectl and kubens commands. (more…)

Kubectl: Get Pods – List All Pods – Kubernetes

A Pod is a group of one or more containers with shared storage, network and lifecycle and is the basic deployable unit in Kubernetes.

Each Pod is scheduled on the same Node, and remains there until termination or deletion.

In case of a Node failure, identical Pods are scheduled on other available Nodes in the cluster.

In this note i will show how to list Pods in Kubernetes cluster and how to get detailed information about them using the kubectl command. (more…)