Posts

Kubernetes - Popular CNI Plugins

 Popular CNI Plugins CNI Best For Network Policy Notes Calico Production, security ✅ Yes Most popular, supports BGP and eBPF Flannel Beginners, small clusters ❌ No (by itself) Very simple and lightweight Cilium High performance ✅ Yes Uses eBPF for advanced networking and security Weave Net Easy setup ✅ Yes Good for small to medium clusters Canal Simplicity + security ✅ Yes Combines Flannel + Calico Antrea VMware environments ✅ Yes Built on Open vSwitch Kube-Router Lightweight ✅ Yes Uses Linux kernel networking AWS VPC CNI Kubernetes on AWS ✅ Yes Pods receive VPC IP addresses Azure CNI Kubernetes on Azure ✅ Yes Pods get Azure Virtual Network IPs Google Cloud Dataplane V2 Kubernetes on Google Cloud ✅ Yes eBPF-based managed networking

Kuberneters Known Errors

Error Meaning Common Cause Typical Fix CrashLoopBackOff Pod repeatedly crashes Application error, missing config, bad image Check kubectl logs and kubectl describe pod ImagePullBackOff Image cannot be pulled Wrong image name, missing registry credentials Verify image name and imagePullSecrets ErrImagePull Initial image pull failed Image doesn't exist or registry unavailable Check registry and image tag Pending Pod not scheduled Insufficient resources, node selectors, taints Run kubectl describe pod to view scheduling events CreateContainerConfigError Invalid container configuration Missing ConfigMap or Secret Verify referenced resources CreateContainerError Container couldn't be created Invalid command, mount, or permissions Check pod events and logs OOMKilled Container exceeded memory limit Memory usage above configured limit Increase memory limit or optimize the application ContainerCreating (stuck) Container is still starting Volume or network issues Check pod events Evicted...

Kubernetes - Connection flow

 Kubernetes Connection Architecture                     +--------------------+                     |      Internet      |                     +---------+----------+                               |                     DNS (example.com)                               |                     +---------v----------+                     | External Load      |                     | Balancer (L4/L7)   |             ...

ETCD -- ETCD Snapshot

 To ensure etcd backups for a production-grade Kubernetes cluster, follow these ste Use etcdctl for Snapshots etcd provides a built-in snapshot mechanism using the etcdctl command-line tool. Here's how to take a backup: Log in to the control plane node where etcd is running. Run the following command to create a snapshot: ETCDCTL_API=3 etcdctl \   --endpoints=https://127.0.0.1:2379 \   --cacert=/etc/kubernetes/pki/etcd/ca.crt \   --cert=/etc/kubernetes/pki/etcd/server.crt \   --key=/etc/kubernetes/pki/etcd/server.key \   snapshot save /path/to/backup/etcd.db Replace /path/to/backup/etcd.db with your desired backup file location. Automate Backups Use a cron job to schedule regular backups. Store backups in a secure location, such as an S3 bucket or a remote server . . Verify Backups After creating a snapshot, verify its integrity: ETCDCTL_API=3 etcdctl snapshot status /path/to/backup/etcd.db Restore from Backup If you need to restore etcd, use the follo...

Laptop : Configure your laptop to connect to AKS - Azure

To configure your laptop to connect to an Azure Kubernetes Service (AKS) cluster, follow these steps: Install Prerequisites Azure CLI: Install the Azure CLI to interact with Azure resources. For installation instructions, visit Azure CLI Installation Guide . kubectl: Install the Kubernetes CLI tool to manage your AKS cluster. Install it using Azure CLI: az aks install-cli Authenticate with Azure Log in to your Azure account using the Azure CLI: az login If you have multiple subscriptions, set the desired subscription: az account set --subscription "<subscription-id>" Connect to the AKS Cluster Retrieve the cluster credentials and configure kubectl : az aks get-credentials --resource-group <resource-group-name> --name <aks-cluster-name> This command downloads the kubeconfig file and sets up kubectl to interact with the cluster. Verify the Connection Check the nodes in your AKS cluster: kubectl get nodes Optional: Use Azure Cloud Shell If you prefer not to ...

Kube-Proxy : Configure Production Grade Cluster

Configuring kube-proxy involves setting up its behavior for managing network traffic within a Kubernetes cluster. Here's a general guide: 1. Understand kube-proxy Modes kube-proxy supports two main modes for handling traffic: iptables Mode: Uses Linux iptables for routing traffic. It's simple and widely supported. IPVS Mode: Uses Linux Virtual Server (IPVS) for advanced load balancing and connection tracking. Configuring iptables mode for kube-proxy involves setting up network rules to route traffic efficiently within a Kubernetes cluster. Here's a step-by-step guide: Step 1: Verify kube-proxy Mode By default, kube-proxy operates in iptables mode . To confirm this: kubectl get configmap kube-proxy -n kube-system -o yaml Look for the mode field in the configuration file. Step 2: Modify kube-proxy Configuration If kube-proxy is not in iptables mode, update its configuration: Edit the kube-proxy ConfigMap: kubectl edit configmap kube-proxy -n kube-system Set the proxy-mod...

ETCD -- Deploying in productin grade cluster

Configuring etcd for a production-grade cluster requires careful planning to ensure high availability, fault tolerance, and consistency. Here's a step-by-step guide for the best configuration practices: 1. Plan a Highly Available Setup Deploy etcd as a distributed cluster with 3, 5, or 7 nodes to ensure fault tolerance. Use an odd number of nodes because etcd relies on quorum-based voting. Quorum: At least (N/2 + 1) nodes need to be available for the cluster to function (e.g., for 3 nodes, 2 must be active). Choose Stable Infrastructure Dedicated Nodes: Run etcd on dedicated nodes separate from other workloads to avoid resource contention. Persistent Storage: Use SSDs for high IOPS and low latency. Backup Strategy: Regularly back up etcd data using tools like etcdctl snapshot or automated backup solutions. Networking Configuration Ensure that low-latency, high-bandwidth networking is in place for cluster communication. Enable TLS encryption for secure communication betw...