Posts

Showing posts with the label kubernetes example

Taints and Tolerations Example in Kubernetes

Image
Taints and Tolerations are advance scheduling mechanism designed to repel pods if they do not have matching toleration.  Pods are only accepted by Nodes if they match desired toleration otherwise Pods remains in Pending state or look for another nodes. In today's example , we will configure nodes and pods with taints and toleration respectively. We will make use of Minikube cluster for managing pods. Pre-requisite : Minikube Cluster  As you can see in above picture , we have two pod one with toleration defined and another without toleration. Since minikube is just one node cluster , we will use master node and apply taints on it. We will see pod scheduling behaviour when toleration applied versus toleration not applied. Let's make sure minikube cluster is running fine and check if master node has taints applied on it. kubectl describe nodes minikube | grep -i taints As you can currently no taints is applied on minikube master node , in this case any pod can be schedul...

Persistent Volume Example in Kubernetes - Stateful Application

Image
Welcome back on Kubernetes tutorial series. In today's tutorial , we will talk about using persistent volumes in kubernetes and a quick demo of setting up persistent volume on your local machine. Persistent volumes are useful for stateful application development where you always keep record of last information processed or maintain database transactional status.  We all know by default if your Pod re-starts then you loose current status of your application which may not be applicable in every scenario. In this example, we will provision PersistentVolume(PV) and PersistentVolumeClaim using default Storage class provisioned by hostPath. There are multiple types of Storage classes supported by Kubernetes. Complete list can be found by below link. https://kubernetes.io/docs/concepts/storage/storage-classes/ Github Location :  https://github.com/shashivish/kubernetes-example/tree/master/pvc-example Pre-requisite : Minikube Cluster On a high level , we will be following below task ...

Resource Request/Limit in Kubernetes

Image
 Hello There , Welcome back again on new post on Kubernetes tutorial. In todays article, we will focus on configuring resource requests and resource limits.   Each Pod requires certain amount of memory and cpu to function but some unusual circumstances Pod can behave weirdly and may consume entire cluster resource causing application and node failures. This behaviour can be controlled by below two configuration in Pod. Requests : It is minimum amount of resource require for Pod to function. Kubernetes will look for available nodes to schedule pod based on requested resource. Limits : It is maximum amount of resource required by Pod can consume. In this article , we will accomplish following points. Create a Pod without Resource Configuration Perform CPU Stress on Container  Observe Resource Utilisation of Pod and Nodes. Enable Resource Configuration in Pod Observe Resource Utilisation of Pod and Nodes again. Pre-requisite : Minikube Cluster  Do cker Image ...