Labels selectors are core grouping primitive in Kubernetes. They are used by the users to select a set of objects. Kubernetes API currently supports two types of selectors − Equality-based selectors.

Labels and selectors

You can constrain a pod to run only on particular nodes. The recommended approach to do this is to use label selectors to make the selection.

Types of Kubernetes Selector

Following are the types of Kubernetes selector.


namespaces in Kubernetes

Kubernetes namespace is an abstraction to support multiple virtual clusters on the same physical cluster.

You can have multiple namespaces within one Kubernetes cluster, and they are all logically isolated from one another.

Namespaces provide a logical separation of cluster resources between multiple users, teams, projects, and even customers. Namespaces are how to divide cluster resources between multiple users (via resource quota).

Namespaces have below functionalities and on basis of the same we tend to use will use them.

  • Within the same Namespace, Pod to Pod communication.
  • Namespaces are virtual cluster sitting on top of physical cluster.
  • Namespaces provide a…


DaemonSets in Kubernetes Cluster

Like other controllers, DaemonSets manage groups of replicated Pods.

However, DaemonSet ensures that all or selected Worker Nodes run a copy of a Pod (one-Pod-per-node).

As you add nodes, DaemonSets automatically add Pods to the new nodes. As the nodes are removed from the cluster, those Pods are garbage collected.

Here is the manifest of DaemonSet:

apiVersion: apps/v1
kind: DaemonSet
metadata:
name: fluentd
namespace: kube-system
labels:
k8s-app: fluentd
spec:
selector:
matchLabels:
name: fluentd
template:
metadata:
labels:
name: fluentd
spec:
containers:
- name: fluentd
image: fluentd:latest

Create a daemonset:

kubectl create -f daemonset.yamldaemonset.apps "fluentd" created

Check the pod running:

kubectl…


Google Kubernetes Engine (also known as GKE) is a managed, production-ready environment for running Docker containers in the Google cloud.

GKE

It permits you to form multiple-node clusters whereas conjointly providing access to any or all Kubernetes options.


Table of Contents

  • Prerequisites
  • Application Architecture
  • Deploy Application
  • Access Application
  • Delete Application

This chapter shows an example of how different microservices within an application can use service discovery to locate each other in the infrastructure rather than via hardcoded IP addresses.

Prerequisites

To perform exercises in this chapter, you’ll need to deploy configurations to a Kubernetes cluster. To create an EKS-based Kubernetes cluster, use the AWS CLI (recommended). If you wish to create a Kubernetes cluster without EKS, you can instead use kops.

All configuration files for this chapter are in the microservices directory. …


K8s

In this article we provide step-by-step instructions for several common ways to set up a Kubernetes cluster on AWS:

  • Creating a cluster with kobs — kops is a production-grade tool used to install, upgrade and manage Kubernetes on AWS.
  • Creating a cluster with Amazon Elastic Kubernetes Service (EKS) — the managed Kubernetes service provided by Amazon. You can create a Kubernetes cluster with EKS using the AWS Management Console.
  • Creating a cluster with Rancher — Rancher is a Kubernetes management platform that eases the deployment of Kubernetes and containers.

Deploying Kubernetes on AWS Using Kops

Kops is a production-grade tool used to install, upgrade, and operate…


Kubernetes Storage Pic Credits https://www.enterprisestorageforum.com/

Data stored in Docker containers are ephemeral i.e. it only exists until the container is alive.

When Kubernetes restart a failed or crashed container, you will lose any data stored in the container filesystem. Kubernetes solves this problem with the help of Volumes.


Monitoring is one of the key components for managing large clusters. For this, we have several tools.

pic Credits https://mpraski.com/

Monitoring with Prometheus

It is a monitoring and alerting system. It was built at SoundCloud and was open-sourced in 2012. It handles the multi-dimensional data very well.

Prometheus has multiple components to participate in monitoring −

  1. Prometheus − It is the core component that scraps and stores data.
  2. Prometheus node explores − Gets the host level matrices and exposes them to Prometheus.
  3. Ranch-eye − is a proxy and exposes cAdvisor stats to Prometheus.
  4. Grafana − Visualization of data.
  5. InfuxDB − Time series database specifically used to…


credits Me and Open source

Persistent Volumes

A PersistentVolume (PV) is a storage resource in the cluster that has been provisioned by an administrator or dynamically provisioned using Storage Classes.

Static Provisioning:

A cluster administrator creates several PVs. They carry the details of the real storage, which is available for use by cluster users.

awsElasticBlockStore:

Before you can use an EBS volume with a Pod, you need to create it.

aws ec2 create-volume \--availability-zone=eu-west-1a \--size=100 \--volume-type=gp2PersistentVolume spec:

Here,

--- 
apiVersion: v1
gcePersistentDisk: ~
kind: PersistentVolume
metadata:
name: test-volume
spec:
accessModes:
- ReadWriteOnce
awsElasticBlockStore:
fsType: ext4
volumeID: ~
capacity:
storage: 100Gi
storageClassName…

Kubernetes Advocate

Founder and CEO of Kubernetes Advocate Tech author, cloud-native architect, entrepreneur, and startup advisor. devopsadvocate2@gmail.com

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