60 SECTIONS · 1621 TOPICS
Kubernetes Roadmap
Understanding Kubernetes Architecture
- 1. Understanding Control Plane Components
- Example: API Server Configuration
- 2. Understanding Node Components
- Example: kubelet configuration
- 3. Understanding Pods as Deployment Units
- Example: Basic Pod Definition
- 4. Understanding Services and Networking
- Example: Exposing a Service with NodePort
- Example: Creating a LoadBalancer Service
- Networking Concepts in Kubernetes
- 5. Understanding Workload Resources
- Example: Deployment Configuration
- Example: StatefulSet Configuration
- 6. Understanding Storage Abstractions
- Example: Using PersistentVolume and PersistentVolumeClaim
- Example: Using StorageClass for Dynamic Provisioning
- 7. Understanding Configuration Resources
- Example: Using ConfigMap in a Pod
- Example: Using Secret in a Pod
- Key Concepts
- 8. Understanding Namespaces and Multi-Tenancy
- Example: Creating a Namespace
- Example: Deploying to a Namespace
- Key Benefits of Namespaces
- Namespaces vs. Clusters
- 9. Understanding API Resources and Extensions
- Example: Creating a Custom Resource Definition (CRD)
- API Resource Categories
- 10. Understanding Cluster Add-Ons
- Example: Deploying CoreDNS Add-On
- Add-Ons Overview
Installing and Configuring kubectl
- 1. Installing kubectl CLI
- Example: Verify kubectl installation
- 2. Configuring kubeconfig File
- Example: Basic kubeconfig structure
- Example: Setting current context
- Example: Adding a new cluster
- Example: Setting a user credential
- 3. Managing Multiple Contexts
- Example: View current context
- Example: List all contexts
- Example: Switch context
- 4. Setting Default Namespace
- 5. Viewing Cluster Information
- Example: kubectl cluster-info Output
- Example: kubectl get nodes Output
- 6. Checking kubectl Version
- Example: Checking kubectl version
- 7. Enabling kubectl Autocompletion
- Example: Bash Autocompletion Setup
- Example: Zsh Autocompletion Setup
- 8. Using kubectl Aliases
- Example: Creating a kubectl alias
- Example: Using a kubectl alias
- 9. Installing kubectl Plugins
- Example: Installing a Plugin via kubectl plugin install
- Example: Manual Plugin Installation
- 10. Configuring Authentication Methods
- Example: Token Authentication
- Example: Client Certificate Authentication
Working with Clusters
- 1. Creating Local Cluster
- Example: Create local cluster with kind
- 2. Connecting to Remote Cluster
- Example: Configure kubectl to connect to a remote cluster
- 3. Viewing Cluster Nodes
- Example: Get node details using kubectl
- Example: Describe a specific node
- 4. Describing Node Details
- Example: Describe Node Details
- Example: Get Node Info in JSON Format
- 5. Labeling Nodes
- Example: Applying Labels to a Node
- Example: Listing Nodes with Labels
- 6. Tainting Nodes
- Example: Taint a Node
- Example: Remove a Taint
- 7. Cordoning Nodes
- Example: Cordon a Node
- Example: Uncordon a Node
- 8. Draining Nodes
- Example: Drain a Node
- 9. Uncordoning Nodes
- Example: Uncordon a Node
- 10. Checking Cluster Health
- Example: kubectl get nodes
- Example: kubectl get pods --all-namespaces
- Example: kubectl describe node minikube
- Workflow: Cluster Health Check Steps
- 11. Viewing API Resources
- Example: Get all pods in a namespace
- Example: Get detailed pod information
- 12. Managing Cluster Certificates
- Example: Renewing a Cluster Certificate
Working with Namespaces
- 1. Creating Namespaces
- Example: Create a Namespace using kubectl
- 2. Listing Namespaces
- Example: Listing Namespaces with Labels
- Example: Listing Namespaces in JSON Format
- 3. Switching Namespaces
- Example: Switching to a Different Namespace
- 4. Deleting Namespaces
- Example: Delete a namespace
- 5. Using Namespace Flag
- Example: Using namespace flag in kubectl commands
- 6. Viewing Resources Across Namespaces
- Example: List all pods across all namespaces
- Example: Get all services across namespaces
- Example: View all deployments in all namespaces
- 7. Setting Resource Quotas
- Example: ResourceQuota YAML Definition
- 8. Configuring Limit Ranges
- Example: LimitRange Configuration
- Key Points
- 9. Understanding Default Namespaces
- Example: Creating a Pod in the Default Namespace
- 10. Isolating Namespaces with Network Policies
- Example: Basic Network Policy to Allow Ingress
- Example: Deny All Egress
- Example: Allow Egress to Specific Namespace
Working with Contexts and Kubeconfig
- 1. Viewing Current Context
- Example: Current Context Output
- 2. Listing All Contexts
- Example: Output of kubectl config get-contexts
- 3. Switching Contexts
- Example: Switching Contexts
- Example: Viewing Current Context
- Example: Listing All Contexts
- 4. Creating New Context
- Example: Create a new context using kubectl
- 5. Renaming Contexts
- Example: Renaming a Context
- 6. Deleting Contexts
- Example: Delete a Context
- 7. Setting Context Namespace
- Example: Setting Namespace in kubeconfig
- 8. Merging Kubeconfig Files
- Example: Merge kubeconfig files
- 9. Viewing Kubeconfig Content
- Example: Display current kubeconfig
- Example: View specific context
- Example: Show current context
- 10. Setting Cluster Server
- Example: Setting Cluster Server URL
- 11. Setting User Credentials
- Example: Configure User Credentials
Creating and Managing Pods
- 1. Creating Pod from YAML
- Example: Basic Pod Definition
- 2. Running Pod Imperatively
- Example: Run a Pod with Environment Variables
- Example: Run a Pod with Resource Limits
- 3. Listing Pods
- Example: Listing Pods in a Namespace
- Example: Listing All Pods with Labels
- 4. Describing Pod Details
- Example: Describe Pod in YAML
- 5. Viewing Pod Logs
- Example: Fetching logs from a pod
- Example: Fetching logs with timestamp
- Example: Fetching logs from a specific container in a pod
- Example: Fetching logs for the last hour
- Example: Fetching last 100 lines of logs
- 6. Following Log Streams
- 7. Executing Commands in Pod
- Example: Executing a command in a pod
- Example: Running a command in a specific container
- 8. Port Forwarding to Pod
- Example: Forwarding Local Port to Pod
- 9. Deleting Pods
- Example: Delete a Pod by Name
- Example: Delete Pods with Label Selector
- 10. Using Pod Selectors
- Example: Label Selector in Deployment
- Example: Field Selector in Pod List
- 11. Watching Pod Status
- Example: Watching Pod Status in Real Time
- Example: Describing a Pod for Detailed Information
- 12. Getting Pod YAML
- 13. Copying Files to Pod
- Example: Copying a file to a pod
- Example: Copying a directory to a pod
Configuring Pod Specifications
- 1. Setting Container Images
- Example: Basic Pod with Container Image
- Example: Pod with Private Image
- 2. Defining Resource Requests
- Example: Defining CPU and Memory Requests
- 3. Defining Resource Limits
- Example: Setting Resource Limits in a Pod Spec
- 4. Configuring Environment Variables
- Example: Setting Environment Variables
- Example: Loading Variables from ConfigMap
- Example: Loading Variables from Secret
- 5. Setting Container Commands
- Example: Overriding entrypoint and arguments
- 6. Configuring Working Directory
- Example: Setting Working Directory
- 7. Setting Security Context
- Example: Setting Security Context for a Pod
- 8. Configuring Pod Priority
- Example: Setting Pod Priority
- 9. Using Pod Preemption Policy
- Example: Setting preemptionPolicy to Never
- 10. Setting Pod Restart Policy
- Example: Setting Restart Policy in Pod Spec
- 11. Configuring Pod DNS Policy
- Example: Setting DNS Policy in Pod Spec
- 12. Using Service Account
- Example: Define ServiceAccount in Pod Spec
Configuring Init Containers
- 1. Understanding Init Container Purpose
- Example: Init Container Setup
- 2. Defining Init Containers
- Example: Basic Init Container Definition
- Example: Init Container with Volume Mount
- 3. Setting Init Container Order
- Example: Defining init containers with dependencies
- 4. Sharing Volumes with Main Containers
- Example: Mounting a Shared Volume
- 5. Setting Init Container Resources
- Example: Setting CPU and Memory Limits in Init Container
- 6. Handling Init Container Failures
- Example: Configuring Init Container with Retry Logic
- Key Points for Handling Failures
- 7. Debugging Init Containers
- Example: Debugging with Logs
- Debugging Workflow
- 8. Using Init Containers for Dependencies
- Example: Waiting for a Database
- 9. Running Database Migrations
- Example: Init Container for Database Migration
- 10. Downloading Configuration Files
- Example: Downloading Config Files from a ConfigMap
- Example: Using Secret to Download Sensitive Data
Configuring Sidecar Containers
- 1. Understanding Sidecar Pattern
- Example: Sidecar Pod Configuration
- 2. Creating Multi-Container Pods
- Example: Pod with Main App and Sidecar
- 3. Sharing Volumes Between Containers
- Example: Mounting a Shared Volume
- 4. Implementing Logging Sidecars
- Example: Logging Sidecar Configuration
- 5. Implementing Proxy Sidecars
- Example: Sidecar Configuration with Nginx
- 6. Using Ambassador Pattern
- Example: Ambassador Sidecar Configuration
- Key Benefits of Ambassador Pattern
- 7. Using Adapter Pattern
- Example: Implementing an Adapter Pattern in a Sidecar
- Adapter Pattern Benefits
- 8. Setting Container Lifecycle
- Example: Container Lifecycle Hooks Configuration
- 9. Configuring Shared Network Namespace
- Example: Enabling Shared Network Namespace
- 10. Debugging Sidecar Containers
- Example: Attaching to a Sidecar Container
- Debugging Approaches
Implementing Health Checks
- 1. Configuring Liveness Probes
- Example: HTTP GET Liveness Probe
- Example: TCP Socket Liveness Probe
- Example: Exec Liveness Probe
- 2. Configuring Readiness Probes
- Example: HTTP Readiness Probe
- 3. Configuring Startup Probes
- Example: Startup Probe Configuration
- 4. Using HTTP Probes
- Example: HTTP Probe Configuration
- 5. Using TCP Probes
- Example: TCP Probe Configuration
- 6. Using Exec Probes
- Example: Exec Probe Configuration
- 7. Using gRPC Probes
- Example: gRPC Probe Configuration
- 8. Setting Initial Delay
- Example: Configuring initialDelaySeconds in a readiness probe
- 9. Configuring Period Seconds
- Example: Configuring periodSeconds in a Probe
- 10. Setting Failure Threshold
- Example: Configuring failureThreshold in a readiness probe
- 11. Setting Success Threshold
- Example: Configuring successThreshold in a readiness probe
- 12. Configuring Timeout Seconds
- Example: Setting timeoutSeconds in a Probe
Working with Pod Lifecycle Hooks
- 1. Understanding Lifecycle Hooks
- Example: Defining Lifecycle Hooks in a Pod Spec
- 2. Configuring PostStart Hook
- Example: PostStart Hook with Exec
- 3. Configuring PreStop Hook
- Example: Exec PreStop Hook
- Example: HTTP PreStop Hook
- Example: TCP Socket PreStop Hook
- 4. Using Exec Handler
- Example: Using exec handler in lifecycle hook
- 5. Using HTTP Handler
- Example: HTTP Handler Configuration
- 6. Implementing Graceful Shutdown
- Example: preStop Hook Configuration
- 7. Understanding Hook Guarantees
- 8. Setting Termination Grace Period
- Example: Setting termination grace period in Pod spec
- 9. Debugging Lifecycle Hooks
- Example: Debugging with Logs
- Example: Inspecting Hook Execution
- Workflow: Debugging Lifecycle Hook Issues
- 10. Using Hooks for Deregistration
- Example: preStop Hook for Deregistration
Working with Labels and Selectors
- 1. Adding Labels to Resources
- Example: Adding Labels to a Pod
- Example: Adding Labels to a Deployment
- 2. Viewing Resource Labels
- Example: Get Pods with Specific Label
- Example: Get Pods with Multiple Labels
- Example: Get Pods with Label Not Equal to Value
- Example: Get Pods with Label Key Exists
- Example: Get Pods with Label Key Does Not Exist
- Label Query Operators
- 3. Filtering by Label Selectors
- Example: Using Label Selectors in a Pod Definition
- Example: Filtering Pods by Label Selector
- 4. Using Equality-Based Selectors
- Example: Using Equality-Based Selectors in a Deployment
- Example: Using Equality-Based Selectors in a Service
- 5. Using Set-Based Selectors
- Example: Using Set-Based Selectors in a Pod
- Example: Using Set-Based Selectors in a Service
- 6. Removing Labels
- Example: Removing a Label from a Pod
- 7. Overwriting Labels
- Example: Updating a Pod's Label
- 8. Using Labels in YAML
- Example: Deploying a Pod with Labels
- 9. Selecting with matchLabels
- Example: Using matchLabels in a Pod Spec
- Example: Using matchLabels in a Service
- 10. Selecting with matchExpressions
- Example: Using matchExpressions in a Pod selector
- matchExpressions Operators
Managing Annotations
- 1. Adding Annotations
- Example: Adding Annotations to a Pod
- 2. Viewing Annotations
- Example: Viewing Annotations on a Pod
- 3. Removing Annotations
- Example: Remove annotation from a pod
- 4. Using Annotations in YAML
- Example: Pod with Annotations
- 5. Understanding Common Annotations
- Example: Using Annotations in a Deployment
- 6. Using Deployment Annotations
- Example: Adding Annotations to a Deployment
- 7. Configuring Ingress Annotations
- Example: Basic Ingress with Annotations
- 8. Using Prometheus Annotations
- Example: Annotating a Deployment for Prometheus
- 9. Setting Autoscaler Annotations
- Example: Setting Annotations on a Deployment
- 10. Understanding Annotation Size Limits
Working with Deployments
- 1. Creating Deployment
- Example: Basic Deployment
- 2. Applying Deployment YAML
- Example: Basic Deployment YAML
- 3. Scaling Deployment
- Example: Scaling Deployment
- Example: Update Replicas Count
- 4. Updating Deployment Image
- Example: Update Deployment Image
- Update Process
- 5. Viewing Rollout Status
- Example: Check rollout status of a deployment
- 6. Viewing Rollout History
- Example: View rollout history
- 7. Rolling Back Deployment
- Example: Rolling Back Deployment
- Example: Check Rollout History
- 8. Pausing Rollouts
- Example: Pausing and Resuming a Rollout
- 9. Resuming Rollouts
- Example: Resuming a Paused Deployment
- 10. Configuring Update Strategy
- Example: Deployment with custom update strategy
- 11. Setting Max Unavailable
- Example: Setting maxUnavailable in Deployment
- 12. Setting Max Surge
- Example: Deployment with maxSurge and maxUnavailable
- 13. Setting Revision History Limit
- Example: Setting Revision History Limit in Deployment YAML
Managing ReplicaSets
- 1. Listing ReplicaSets
- Example: Listing ReplicaSets in default namespace
- Example: Listing ReplicaSets with wide output
- 2. Describing ReplicaSet Details
- Example: Describe a ReplicaSet
- Example: Get ReplicaSet YAML
- 3. Scaling ReplicaSets
- Example: Scaling a ReplicaSet
- 4. Deleting ReplicaSets
- Example: Delete a ReplicaSet
- Example: Delete a ReplicaSet and keep its Pods
- 5. Understanding ReplicaSet Selectors
- Example: ReplicaSet with Label Selectors
- 6. Viewing ReplicaSet Ownership
- Example: Describe ReplicaSet to View Ownership
- Example: Get ReplicaSet with Owner References
- 7. Viewing ReplicaSet Pods
- Example: Get ReplicaSet Pod List
- Example: Describe ReplicaSet
- 8. Orphaning Pods During Deletion
- Example: Orphaning Pods During ReplicaSet Deletion
- 9. Understanding ReplicaSet vs Deployment
- When to Use Which?
- 10. Troubleshooting ReplicaSet Issues
- Example: Check ReplicaSet Status
- Example: Describe ReplicaSet
Managing StatefulSets
- 1. Creating StatefulSet
- Example: Basic StatefulSet Configuration
- 2. Listing StatefulSets
- Example: List all StatefulSets in the current namespace
- Example: List all StatefulSets in all namespaces
- Example: List StatefulSets with additional details
- 3. Describing StatefulSet Details
- Example: Basic StatefulSet Definition
- 4. Scaling StatefulSet
- Example: Scaling StatefulSet
- 5. Understanding Ordered Pod Creation
- Example: Setting Ordered Pod Creation
- 6. Using Parallel Pod Management
- Example: Setting Parallel Pod Management
- 7. Configuring Volume Claim Templates
- Example: Volume Claim Template Configuration
- 8. Using Headless Services
- Example: Headless Service Definition
- 9. Understanding Stable Network IDs
- Example: Headless Service Configuration
- 10. Updating StatefulSets
- Example: Update Strategy Configuration
- 11. Deleting StatefulSets
- Example: Delete a StatefulSet with foreground cascading
- 12. Troubleshooting StatefulSet Issues
- Example: Debugging Pod Events
- Example: Checking Volume Claims
Working with DaemonSets
- 1. Creating DaemonSet
- Example: Basic DaemonSet YAML
- 2. Listing DaemonSets
- Example: Listing DaemonSets in the default namespace
- Example: Listing all DaemonSets across all namespaces
- 3. Describing DaemonSet Details
- Example: DaemonSet YAML Definition
- 4. Understanding DaemonSet Scheduling
- Example: DaemonSet with update strategy
- 5. Using Node Selectors
- Example: DaemonSet with Node Selector
- 6. Using Node Affinity
- Example: Node Affinity Configuration
- 7. Tolerating Taints
- Example: Tolerating Master Node Taints
- 8. Updating DaemonSets
- Example: Update DaemonSet with RollingUpdate
- 9. Setting Max Unavailable
- Example: Setting maxUnavailable to 20%
- 10. Deleting DaemonSets
- Example: Delete a DaemonSet
- 11. Troubleshooting DaemonSet Pods
- Example: Check DaemonSet Pod Status
Managing Jobs
- 1. Creating Job
- Example: Creating a Job
- 2. Creating Job from CronJob
- Example: Creating a CronJob that runs a Job daily
- 3. Listing Jobs
- Example: Listing Jobs in Current Namespace
- Example: Listing Jobs Across All Namespaces
- 4. Describing Job Details
- Example: Describe Job Details
- 5. Setting Completions Count
- Example: Setting Completions Count
- 6. Setting Parallelism Level
- Example: Setting parallelism to 3
- 7. Configuring Backoff Limit
- Example: Setting Backoff Limit
- 8. Setting Active Deadline
- Example: Setting Active Deadline on a Job
- 9. Using Job Selectors
- Example: Label Selector
- Example: Field Selector
- 10. Viewing Job Logs
- Example: View job logs
- Example: View logs from previous job run
- 11. Deleting Jobs
- Example: Delete a Job by Name
- Example: Delete a Job in a Specific Namespace
- Example: Delete All Jobs in a Namespace
- 12. Cleaning Up Finished Jobs
- Example: Setting TTL for Job Cleanup
Working with CronJobs
- 1. Creating CronJob
- Example: Creating a CronJob
- 2. Listing CronJobs
- Example: List CronJobs in a Namespace
- Example: List All CronJobs Across All Namespaces
- 3. Describing CronJob Details
- Example: CronJob Spec
- 4. Setting Schedule Expression
- Example: Cron Schedule Expression
- 5. Understanding Cron Syntax
- Example: Cron Schedule Expression
- 6. Configuring Concurrency Policy
- Example: Setting Concurrency Policy in CronJob
- 7. Setting Successful Jobs History
- Example: Setting Successful Jobs History Limit
- 8. Setting Failed Jobs History
- Example: Setting Failed Jobs History Limit
- 9. Suspending CronJobs
- Example: Suspending a CronJob
- 10. Setting Starting Deadline
- Example: CronJob with startingDeadlineSeconds
- 11. Creating Manual Job Run
- Example: Creating a CronJob
- Example: Manually Triggering a CronJob
- 12. Deleting CronJobs
- Example: Delete a CronJob
Creating and Managing Services
- 1. Creating ClusterIP Service
- Example: Creating a ClusterIP Service
- 2. Creating NodePort Service
- Example: NodePort Service YAML
- 3. Creating LoadBalancer Service
- Example: Creating a LoadBalancer Service
- 4. Creating Headless Service
- Example: Headless Service Definition
- 5. Listing Services
- Example: List all services with extended output
- Example: List services in a specific namespace
- 6. Describing Service Details
- Example: Describe Service Details
- Service Types Overview
- 7. Exposing Deployments
- Example: Exposing a Deployment with NodePort
- Example: Exposing a Deployment with LoadBalancer
- 8. Configuring Service Selectors
- Example: Basic Service with Label Selector
- Example: Service with MatchExpressions
- 9. Configuring Session Affinity
- Example: Service with ClientIP Session Affinity
- 10. Setting External IPs
- Example: Service with External IPs
- 11. Using ExternalName Services
- Example: Define an ExternalName Service
- 12. Viewing Service Endpoints
- Example: Get Endpoints for a Service
Working with Ingress
- 1. Creating Ingress Resource
- Example: Basic Ingress Configuration
- 2. Listing Ingress Resources
- Example: Listing Ingress in a specific namespace
- 3. Describing Ingress Details
- Example: Describe Ingress Details
- 4. Configuring Ingress Rules
- Example: Basic Ingress Rule
- Example: Multiple Paths with Different Services
- 5. Setting Default Backend
- Example: Default Backend Configuration
- 6. Using Path Types
- Example: Ingress with Path Types
- 7. Configuring TLS Termination
- Example: Ingress with TLS
- 8. Using Ingress Annotations
- Example: Using Ingress Annotations
- 9. Setting Ingress Class
- Example: Define Ingress with Class
- 10. Installing Ingress Controllers
- Example: Deploying NGINX Ingress Controller
- 11. Troubleshooting Ingress
- Common Ingress Issues and Solutions
- Example: Check Ingress Controller Logs
- Example: Verify Service and Pod Status
Working with Gateway API
- 1. Installing Gateway API CRDs
- Example: Install Gateway API CRDs using kubectl
- 2. Creating GatewayClass Resource
- Example: Creating a GatewayClass Resource
- 3. Creating Gateway Resource
- Example: Basic Gateway Resource
- 4. Configuring HTTPRoute
- Example: Basic HTTPRoute Configuration
- Example: Route with Multiple Rules
- 5. Using TCPRoute
- Example: Basic TCPRoute Configuration
- 6. Using TLSRoute
- Example: TLSRoute with Certificate Reference
- 7. Setting Gateway Listeners
- Example: Basic HTTP Listener
- Example: HTTPS Listener with TLS
- 8. Configuring Backend References
- Example: Basic Backend Reference
- Example: Weighted Backend Routing
- 9. Using Request Matching
- Example: Matching a GET request with specific headers
- 10. Implementing Traffic Splitting
- Example: Basic Traffic Splitting Rule
- Key Concepts
- 11. Understanding Gateway API vs Ingress
- Gateway API vs Ingress
Managing ConfigMaps
- 1. Creating ConfigMap from Literal
- Example: Creating ConfigMap from Literal Values
- 2. Creating ConfigMap from File
- Example: Creating ConfigMap from File
- 3. Creating ConfigMap from Env File
- Example: Creating ConfigMap from env file
- 4. Creating ConfigMap from YAML
- Example: Creating a ConfigMap from YAML
- 5. Listing ConfigMaps
- Example: Listing ConfigMaps in Current Namespace
- Example: Listing All ConfigMaps Across Namespaces
- 6. Describing ConfigMap Details
- Example: Describe ConfigMap using kubectl
- Example: Get ConfigMap details in YAML format
- 7. Using ConfigMap as Environment Variables
- Example: Using ConfigMap as Environment Variables
- Example: Using Specific ConfigMap Key as Environment Variable
- 8. Mounting ConfigMap as Volume
- Example: Mounting ConfigMap as Volume
- 9. Using Specific ConfigMap Keys
- Example: Mounting Specific Keys
- Example: Using Keys in Environment Variables
- 10. Updating ConfigMaps
- Example: Patching a ConfigMap
- Example: Editing a ConfigMap
- 11. Using Immutable ConfigMaps
- Example: Creating an Immutable ConfigMap
- 12. Deleting ConfigMaps
- Example: Delete a ConfigMap
- Example: Delete a ConfigMap in a specific namespace
Managing Secrets
- 1. Creating Generic Secret
- Example: Creating a Generic Secret from Literal Values
- Example: Creating a Secret from Environment File
- 2. Creating TLS Secret
- Example: Create TLS Secret from Files
- Example: Create TLS Secret from Literal Values
- 3. Creating Docker Registry Secret
- Example: Creating a Docker Registry Secret from .docker/config.json
- 4. Encoding Secret Data
- Example: Encoding a Secret Value
- 5. Listing Secrets
- Example: Listing Secrets in a Namespace
- 6. Describing Secret Details
- Example: Describe Secret Details
- 7. Using Secrets as Environment Variables
- Example: Injecting All Secret Values as Environment Variables
- Example: Using Specific Secret Key as Environment Variable
- 8. Mounting Secrets as Volumes
- Example: Mounting a Secret as a Volume
- 9. Using imagePullSecrets
- Example: Define imagePullSecrets in a Pod
- Example: Define imagePullSecrets in a Deployment
- 10. Updating Secrets
- Example: Updating a Secret with kubectl
- Example: Updating a Secret with kubectl edit
- 11. Understanding Secret Types
- 12. Deleting Secrets
- Example: Delete a Secret
- Example: Delete a Secret with Cascading
Working with Service Accounts
- 1. Creating Service Account
- Example: Creating a Service Account
- 2. Listing Service Accounts
- Example: List Service Accounts in a Namespace
- Example: List All Service Accounts Across Namespaces
- 3. Describing Service Account Details
- Example: Describe Service Account
- Example: Get Service Account as YAML
- 4. Using Service Account in Pod
- Example: Using Service Account in Pod
- 5. Understanding Default Service Account
- Example: Pod using default service account
- 6. Configuring Automount Token
- Example: Disabling Automount Token
- 7. Creating Service Account Token
- Example: Create ServiceAccount with Token
- Example: Create Token Secret for ServiceAccount
- 8. Using Bound Service Account Tokens
- Example: Creating a Bound Token
- Example: Using Bound Token in Pod
- 9. Configuring Token Expiration
- Example: Setting Token Expiration in ServiceAccount
- 10. Deleting Service Accounts
- Example: Delete Service Account
Working with Volumes
- 1. Using emptyDir Volumes
- Example: Mounting an emptyDir Volume
- 2. Using hostPath Volumes
- Example: Mounting hostPath volume in Pod
- 3. Configuring PersistentVolumes
- Example: Creating a PersistentVolume
- 4. Creating PersistentVolumeClaims
- Example: Creating a PVC
- 5. Binding PVC to PV
- Example: Binding PVC to PV
- 6. Listing PersistentVolumes
- Example: Listing PersistentVolumes using kubectl
- Example: Listing PersistentVolumes with detailed output
- Example: Listing PersistentVolumes in JSON format
- 7. Listing PersistentVolumeClaims
- Example: List PVCs in a Namespace
- Example: List All PVCs in the Cluster
- Example: Describe a Specific PVC
- 8. Understanding Access Modes
- 9. Setting Reclaim Policies
- Example: Setting Reclaim Policy to Retain
- 10. Using Dynamic Provisioning
- Example: Creating a PersistentVolumeClaim with Dynamic Provisioning
- 11. Expanding PersistentVolumes
- Example: Expanding a PersistentVolume
- Key Points
- 12. Deleting PersistentVolumeClaims
- Example: Delete PVC using kubectl
Configuring Storage Classes
- 1. Creating StorageClass
- Example: Creating a StorageClass for AWS EBS
- 2. Listing StorageClasses
- Example: List StorageClasses using kubectl
- Example: List StorageClasses with detailed output
- 3. Setting Default StorageClass
- Example: Setting Default StorageClass
- 4. Configuring Provisioners
- Example: Configuring AWS EBS Provisioner
- Example: Configuring GCP PD Provisioner
- 5. Setting Volume Binding Mode
- Example: Setting Volume Binding Mode in StorageClass
- 6. Configuring Reclaim Policy
- Example: Setting Reclaim Policy in StorageClass
- 7. Enabling Volume Expansion
- Example: Enabling Volume Expansion in StorageClass
- 8. Using Storage Parameters
- Example: Storage Class with Parameters
- 9. Configuring Mount Options
- Example: Setting Mount Options in StorageClass
- 10. Deleting StorageClasses
- Example: Delete StorageClass
Working with Volume Snapshots
- 1. Installing VolumeSnapshot CRDs
- Example: Apply VolumeSnapshot CRDs
- 2. Creating VolumeSnapshotClass
- Example: VolumeSnapshotClass YAML Definition
- 3. Creating VolumeSnapshot
- Example: Creating a VolumeSnapshot from a PVC
- 4. Listing VolumeSnapshots
- Example: Listing VolumeSnapshots using kubectl
- Example: Listing VolumeSnapshots with details using kubectl
- Example: Listing VolumeSnapshots in a specific namespace
- 5. Describing VolumeSnapshot Details
- Example: Describe VolumeSnapshot in YAML
- Example: Describe VolumeSnapshot using kubectl
- 6. Restoring PVC from Snapshot
- Example: Restoring PVC from VolumeSnapshot
- 7. Configuring Snapshot Deletion Policy
- Example: Snapshot Deletion Policy Configuration
- 8. Using Snapshot with CSI Drivers
- Example: Create Volume from Snapshot
- 9. Deleting VolumeSnapshots
- Example: Delete VolumeSnapshot using kubectl
- 10. Troubleshooting Snapshot Issues
- Example: Describe VolumeSnapshot for diagnostics
Working with Projected Volumes
- 1. Understanding Projected Volumes
- Example: Projecting a ConfigMap and Secret
- 2. Projecting Secrets
- Example: Projecting a Secret
- 3. Projecting ConfigMaps
- Example: Projecting a ConfigMap
- 4. Projecting Service Account Tokens
- Example: Configuring Service Account Token Projection
- 5. Projecting Downward API
- Example: Projecting Pod Name
- Example: Projecting Pod Namespace
- Example: Projecting Pod Labels
- 6. Configuring Token Expiration
- Example: Using Token Expiration in a Projected Volume
- 7. Setting Token Audience
- Example: Configuring Token Audience in ServiceAccount
- 8. Combining Multiple Sources
- Example: ConfigMap and Secret in One Projected Volume
- 9. Using Projected Volumes for mTLS
- Example: mTLS Configuration
- 10. Debugging Projected Volumes
- Example: Check Volume Mounts in Pod
Configuring Resource Management
- 1. Setting CPU Requests
- Example: Setting CPU Requests in a Pod
- 2. Setting Memory Requests
- Example: Setting Memory Requests in a Pod Spec
- 3. Setting CPU Limits
- Example: CPU Limits in Pod Spec
- 4. Setting Memory Limits
- Example: Setting Memory Limits in a Pod
- 5. Understanding Resource Units
- Example: Resource Requests and Limits in Pod Spec
- 6. Configuring LimitRange
- Example: LimitRange Configuration
- 7. Setting ResourceQuota
- Example: ResourceQuota YAML Definition
- 8. Viewing Resource Usage
- Example: Resource Usage Output
- Key Points
- 9. Understanding QoS Classes
- Example: QoS Class Determination
- QoS Class Summary
- 10. Setting Priority Classes
- Example: Creating a PriorityClass
- 11. Configuring Pod Disruption Budgets
- Example: Basic PDB Configuration
- Example: PDB with maxUnavailable
- Key Points
- 12. Using Extended Resources
- Example: Requesting Extended Resource in Pod Spec
Implementing Horizontal Pod Autoscaling
- 1. Creating HPA
- Example: HPA Configuration
- 2. Creating HPA from YAML
- Example: HPA Configuration
- 3. Listing HPAs
- Example: Listing HPAs in a Namespace
- 4. Describing HPA Details
- Example: Describe HPA in YAML
- HPA Configuration Summary
- 5. Setting Min and Max Replicas
- Example: HPA with min and max replicas
- 6. Using CPU-Based Scaling
- Example: HPA Configuration Using CPU Utilization
- 7. Using Memory-Based Scaling
- Example: Memory-based HPA Configuration
- 8. Using Custom Metrics
- Example: External Custom Metric
- Example: Object Metric
- 9. Configuring Scale Up Behavior
- Example: HPA Configuration
- 10. Configuring Scale Down Behavior
- Example: Configuring Scale Down Behavior in HPA
- 11. Setting Stabilization Window
- Example: Configuring Stabilization Window in HPA
- 12. Troubleshooting HPA
- Common HPA Issues and Solutions
- Example: Debugging HPA Metrics
Implementing Vertical Pod Autoscaling
- 1. Installing VPA Components
- Example: Install VPA using Helm
- 2. Creating VPA Resource
- Example: Basic VPA Configuration
- 3. Setting Update Mode
- Example: Setting Update Mode in VPA Spec
- 4. Configuring Resource Policy
- Example: VPA Resource Policy Configuration
- 5. Setting Min Allowed Resources
- Example: VPA Configuration with Min Allowed Resources
- 6. Setting Max Allowed Resources
- Example: Configuring Max Allowed Resources in VPA
- 7. Viewing VPA Recommendations
- Example: Viewing VPA Recommendations via kubectl
- Example: Viewing VPA Status
- 8. Understanding VPA Components
- Example: VPA Controller Configuration
- 9. Using VPA with HPA
- Vertical Pod Autoscaler (VPA) vs Horizontal Pod Autoscaler (HPA)
- Example: VPA Configuration
- Example: HPA Configuration
- Best Practices for Using VPA with HPA
- 10. Deleting VPA Resources
- Example: Deleting a VPA Resource
Working with Taints and Tolerations
- 1. Adding Taints to Nodes
- Example: Add a taint to a node
- Example: Add a taint with multiple keys and values
- 2. Removing Taints from Nodes
- Example: Remove taint from node
- 3. Listing Node Taints
- Example: List taints on a node
- 4. Understanding Taint Effects
- Example: Applying Taints with Different Effects
- 5. Configuring Tolerations
- Example: Pod with Tolerations
- 6. Using Toleration Operators
- Example: Using Equal Operator
- Example: Using Exists Operator
- 7. Setting Toleration Seconds
- Example: Setting Toleration Seconds on a Pod
- 8. Understanding Default Tolerations
- Example: Default toleration in a Pod spec
- 9. Using Taints for Dedicated Nodes
- Example: Taint a Node for Dedicated Use
- Example: Pod with Tolerations for Dedicated Node
- 10. Combining Taints with Node Affinity
- Example: Taints and Affinity Together
Configuring Node Affinity
- 1. Using requiredDuringScheduling
- Example: Node Affinity with requiredDuringScheduling
- 2. Using preferredDuringScheduling
- Example: Preferred Node Affinity
- 3. Configuring Node Selectors
- Example: Setting Node Selector
- 4. Using matchExpressions
- Example: matchExpressions with In operator
- Example: matchExpressions with Gt operator
- 5. Setting Node Label Selectors
- Example: Setting Node Label Selectors
- 6. Combining Multiple Affinity Rules
- Example: Combining nodeSelector and nodeAffinity
- Example: Using podAntiAffinity to avoid duplicate pods
- 7. Using Node Anti-Affinity
- Example: Anti-Affinity with Label Match
- Example: Hard Anti-Affinity Using Node Selector
- 8. Setting Weight Priority
- Example: Node Affinity with Weight
- 9. Using IgnoredDuringExecution
- Example: Node Affinity with IgnoredDuringExecution
- 10. Troubleshooting Affinity Rules
- Example: Debugging Node Affinity Issues
Configuring Pod Affinity and Anti-Affinity
- 1. Using Pod Affinity
- Example: Affinity Rule for Same Node
- Example: Soft Affinity with Preferred Rules
- 2. Using Pod Anti-Affinity
- Example: Pod Anti-Affinity with topologyKey
- Example: Preferred Anti-Affinity
- 3. Setting Topology Keys
- Example: Pod Affinity with Topology Key
- Example: Pod Anti-Affinity with Topology Key
- 4. Using requiredDuringScheduling
- Example: Pod Affinity with requiredDuringScheduling
- Example: Pod Anti-Affinity with requiredDuringScheduling
- 5. Using preferredDuringScheduling
- Example: Preferred Affinity Rule
- 6. Configuring Label Selectors
- Example: Using matchLabels
- Example: Using matchExpressions
- 7. Setting Namespace Selectors
- Example: Using namespaceSelector in Pod Affinity
- 8. Understanding Topology Domains
- 9. Combining Affinity Rules
- Example: Combining Node and Pod Affinity
- 10. Troubleshooting Pod Placement
- Steps to Troubleshoot Pod Placement Issues
- Example: Describe Pod to Find Scheduling Issues
Configuring Pod Topology Spread Constraints
- 1. Understanding Topology Spread
- Example: Basic Topology Spread Constraint
- 2. Setting Maximum Skew
- Example: Setting maxSkew to 2
- 3. Configuring When Unsatisfiable
- Example: Setting
- 4. Using Topology Keys
- Example: Pod with Topology Key
- 5. Configuring Label Selectors
- Example: Using labelSelector in Pod Topology Spread Constraints
- 6. Setting Match Label Keys
- Example: Match Label Keys Configuration
- 7. Using Min Domains
- Example: Setting minDomains in Pod Spec
- 8. Combining Multiple Constraints
- Example: Pod Topology Spread Constraints with Multiple Selectors
- Best Practices for Combining Constraints
- 9. Understanding Node Inclusion Policy
- Example: NodeInclusionPolicy in Pod Spec
- 10. Troubleshooting Spread Issues
- Example: Misconfigured Topology Spread Constraint
- Workflow: Diagnose Spread Constraint Issues
Configuring Network Policies
- 1. Creating NetworkPolicy
- Example: Basic Ingress Policy
- Example: Egress Policy
- 2. Defining Pod Selectors
- Example: Using matchLabels
- Example: Using matchExpressions
- 3. Configuring Ingress Rules
- Example: Basic Ingress Rule
- 4. Configuring Egress Rules
- Example: Allow Egress to DNS Server
- Example: Allow Egress to Specific Namespace
- 5. Using Namespace Selectors
- Example: Allow traffic from production namespace to default namespace
- 6. Allowing Specific Ports
- Example: Allow HTTP traffic on port 80
- Example: Allow traffic on a port range
- 7. Using IP Blocks
- Example: Allow traffic from a specific IP block
- Example: Allow traffic from a specific IP block but exclude a subnet
- 8. Implementing Default Deny All
- Example: Default Deny All Policy
- 9. Testing Network Policies
- Example: Testing Network Policy with curl
- Testing Steps Summary
- 10. Listing Network Policies
- Example: Listing Network Policies in a Namespace
Configuring RBAC Authorization
- 1. Creating ServiceAccount
- Example: Create a ServiceAccount
- 2. Creating Role
- Example: Define a Role to Read Pods
- 3. Creating ClusterRole
- Example: Define a ClusterRole with Pod Access
- 4. Creating RoleBinding
- Example: Creating a RoleBinding
- 5. Creating ClusterRoleBinding
- Example: Creating a ClusterRoleBinding
- 6. Viewing Permissions
- Example: Check permissions for a user
- 7. Testing User Permissions
- Example: Check Permission for Pod List
- Example: Simulate User Access
- 8. Using Default ClusterRoles
- Example: Assigning ClusterRole to a User
- 9. Configuring API Groups
- Example: Define a Role with API Group Permissions
- 10. Setting Resource Names
- Example: Defining a Role with Resource Names
- Example: Binding a Role to a User
- 11. Understanding Verbs
- 12. Aggregating ClusterRoles
- Example: Aggregating ClusterRoles
Managing Security Context
- 1. Setting runAsUser
- Example: Setting runAsUser in Pod Spec
- 2. Setting runAsGroup
- Example: Setting runAsGroup in Pod Spec
- 3. Setting fsGroup
- Example: Setting fsGroup in Pod Spec
- 4. Running as Non-Root
- Example: Setting Non-Root User
- 5. Setting Read-Only Root Filesystem
- Example: Pod with Read-Only Root Filesystem
- 6. Adding Capabilities
- Example: Adding Capabilities to a Pod
- 7. Dropping Capabilities
- Example: Dropping Capabilities in Pod Spec
- 8. Using Privileged Mode
- Example: Setting privileged mode in a Pod
- 9. Setting SELinux Options
- Example: Setting SELinux Context for a Pod
- 10. Configuring Seccomp Profiles
- Example: Applying a Seccomp Profile
- 11. Setting AppArmor Profiles
- Example: AppArmor Profile in Pod Spec
Implementing Pod Security Admission
- 1. Understanding Pod Security Standards
- Example: Applying Pod Security Standard
- 2. Using Pod Security Admission
- Example: Enforcing Pod Security Admission
- 3. Configuring Namespace Labels
- Example: Applying Pod Security Labels to a Namespace
- 4. Setting Enforce Level
- Example: Enforce Level Configuration
- 5. Setting Audit Level
- Example: Setting Audit Level in Kubernetes
- 6. Setting Warn Level
- Example: Setting Warn Level in a Namespace
- 7. Controlling Host Namespaces
- Example: Setting hostNetwork to true in a Pod
- 8. Restricting Volume Types
- Example: Restricting Volume Types in Pod Security Admission
- 9. Configuring Allowed Capabilities
- Example: Pod with Allowed Capabilities
- 10. Migrating from PodSecurityPolicy
- Example: Migrating PSP to Pod Security Admission
- Migration Steps
Working with Admission Controllers
- 1. Understanding Admission Controllers
- Example: Admission Controller Configuration
- 2. Enabling Admission Plugins
- Example: Enabling a Custom Admission Plugin via Webhook
- 3. Using ValidatingWebhookConfiguration
- Example: ValidatingWebhookConfiguration YAML
- 4. Using MutatingWebhookConfiguration
- Example: MutatingWebhookConfiguration YAML
- 5. Implementing OPA Gatekeeper
- Example: Basic OPA Gatekeeper Policy
- Example: Constraint Template
- Key Concepts
- 6. Creating Constraint Templates
- Example: Basic Constraint Template
- 7. Creating Constraints
- Example: Constraint Template
- Example: Constraint Instance
- 8. Implementing Image Policy
- Example: Image Policy Configuration
- Example: Image Policy Enforcement
- 9. Using LimitRanger
- Example: LimitRanger Configuration
- Example: Pod with LimitRanger Enforced Limits
- 10. Testing Admission Webhooks
- Example: Testing Admission Webhook with curl
- Example: Validating Admission Response
- Testing Workflow
- 11. Troubleshooting Admission Failures
- Example: Checking Admission Controller Logs
- Workflow: Debugging Admission Controller Issues
Managing Cluster Certificates
- 1. Viewing Certificate Expiration
- Example: Check Certificate Expiry via kubectl
- Example: Using OpenSSL to Parse Cert
- 2. Renewing Certificates
- Example: Renewing kube-apiserver Certificate
- 3. Generating New Certificates
- Example: Using kubectl to generate a new certificate
- 4. Configuring Certificate Rotation
- Example: Enabling Certificate Rotation for Kubelet
- Example: API Server Certificate Rotation Configuration
- 5. Installing cert-manager
- Example: Installing cert-manager via Helm
- Example: Installing cert-manager via kubectl
- Installation Steps
- 6. Creating Certificate Resources
- Example: Creating a Certificate Resource
- 7. Configuring Issuers
- Example: ACME Issuer Configuration
- Example: Self-Signed Issuer
- Example: ClusterIssuer for Wildcard Certificates
- 8. Using ACME Protocol
- Example: ACME Configuration in Kubernetes
- 9. Troubleshooting Certificate Issues
- Example: Renewing a Certificate
- Certificate Troubleshooting Workflow
- 10. Updating kubeconfig After Renewal
- Example: Update kubeconfig with new certificate
Managing External Secrets
- 1. Installing External Secrets Operator
- Example: Install External Secrets Operator using Helm
- Installation Steps
- 2. Creating SecretStore
- Example: AWS SecretStore
- Example: Vault SecretStore
- 3. Creating ClusterSecretStore
- Example: Creating a ClusterSecretStore for AWS Secrets Manager
- 4. Creating ExternalSecret Resource
- Example: Creating an ExternalSecret
- 5. Syncing Secrets Automatically
- Example: ExternalSecret Configuration
- 6. Using Secret Templates
- Example: Define a Secret Template
- Example: Using Template in Deployment
- 7. Configuring Secret Keys
- Example: Secret Key Configuration
- Example: Using Secret Keys in Pod
- 8. Rotating Secrets
- Example: Manual Rotation of Opaque Secret
- Example: Using Sealed Secrets for Rotation
- 9. Configuring Data Transformation
- Example: Transforming Secret Data
- 10. Troubleshooting Secret Sync
- Example: Check Secret Status
- Example: Describe Pod Volume Mount
Managing Custom Resource Definitions
- 1. Creating CRD
- Example: Basic CRD Definition
- 2. Listing CRDs
- Example: List CRDs using kubectl
- Example: List CRDs with detailed output
- Example: List CRDs in JSON format
- 3. Describing CRD Details
- Example: CRD Definition
- 4. Defining CRD Versions
- Example: Defining a CRD with multiple versions
- 5. Setting CRD Scope
- Example: Namespaced CRD
- Example: Cluster-scoped CRD
- 6. Configuring Validation Schema
- Example: Validating Custom Resource Fields
- 7. Using CRD Subresources
- Example: Status Subresource
- Example: Scale Subresource
- 8. Setting Printer Columns
- Example: Printer Column Definition
- 9. Creating Custom Resources
- Example: Define a Custom Resource Definition (CRD)
- Example: Create a Custom Resource using the CRD
- 10. Understanding CRD Finalizers
- Example: CRD with Finalizer
- 11. Deleting CRDs
- Example: Delete CRD using kubectl
- 2. Listing CRDs
- Example: List CRDs using kubectl
- Example: List CRDs with detailed output
- Example: List CRDs in JSON format
- 3. Describing CRD Details
- Example: CRD Definition
- 4. Defining CRD Versions
- Example: Defining a CRD with multiple versions
- 5. Setting CRD Scope
- Example: Namespaced CRD
- Example: Cluster-scoped CRD
- 6. Configuring Validation Schema
- Example: Validating Custom Resource Fields
- 7. Using CRD Subresources
- Example: Status Subresource
- Example: Scale Subresource
- 8. Setting Printer Columns
- Example: Printer Column Definition
- 9. Creating Custom Resources
- Example: Define a Custom Resource Definition (CRD)
- Example: Create a Custom Resource using the CRD
- 10. Understanding CRD Finalizers
- Example: CRD with Finalizer
- 11. Deleting CRDs
- Example: Delete CRD using kubectl
Working with Operators
- 1. Understanding Operator Pattern
- Example: Operator Deployment
- Operator vs Helm Chart
- 2. Installing Operators
- Example: Installing via OperatorHub
- 3. Using Operator Lifecycle Manager
- Example: Install OLM via YAML
- Key Concepts
- 4. Creating Custom Resources
- Example: Creating a Custom Resource
- 5. Viewing Operator Logs
- Example: Viewing Operator Logs
- Example: Streaming Operator Logs
- 6. Updating Custom Resources
- Example: Update Custom Resource Spec
- 7. Monitoring Operator Status
- Example: Operator Status Output
- 8. Troubleshooting Operators
- Common Troubleshooting Steps
- Operator vs Helm Chart Debugging
- 9. Upgrading Operators
- 10. Deleting Operators
- Example: Delete Operator Deployment
- Example: Delete CRDs
Working with Helm Charts
- 1. Installing Helm CLI
- Example: Verify Installation
- 2. Adding Helm Repositories
- Repository Management
- 3. Updating Helm Repositories
- Example: Update all repositories
- Example: Update specific repository
- 4. Searching Helm Charts
- Example: Search for charts in a repository
- Example: Search for charts in Artifact Hub
- 5. Installing Helm Chart
- Example: Installing a Helm Chart
- 6. Upgrading Helm Release
- Example: Upgrading a Release
- Example: Upgrading with Values File
- Example: Upgrading with Set Values
- 7. Rolling Back Release
- Example: Rolling Back to Previous Revision
- Example: Rolling Back to Last Successful Revision
- 8. Listing Helm Releases
- Example: Listing Helm Releases in a Specific Namespace
- Example: Listing All Helm Releases Across Namespaces
- 9. Viewing Release Values
- Example: Fetching Release Values
- Example: Fetching All Values Including Defaults
- 10. Uninstalling Helm Release
- Example: Uninstalling a Helm Release
- Example: Dry Run Uninstall
- 11. Creating Custom Chart
- Example: Basic Chart Structure
- Example: Deployment Template
- Example: Values Override
- 12. Using Helm Templating
- Example: Using .Values in a Deployment
- Example: Conditional Template with .Values
Working with Kustomize
- 1. Understanding Kustomize Concepts
- Example: Basic Kustomization Structure
- Key Benefits of Kustomize
- 2. Creating kustomization.yaml
- Example: Basic kustomization.yaml
- 3. Applying Kustomize Manifests
- Example: Applying Kustomize Manifests
- 4. Using Strategic Merge Patches
- Example: Applying Strategic Merge Patch
- 5. Using JSON Patches
- Example: Applying a JSON Patch
- Example: JSON Patch Content
- 6. Configuring Name Prefixes
- Example: Applying Name Prefix
- 7. Generating ConfigMaps
- Example: Creating a ConfigMap from literals
- Example: Creating a ConfigMap from a file
- 8. Generating Secrets
- Example: Creating a Secret from Literal Values
- Example: Creating a Secret from a File
- 9. Setting Common Labels
- Example: Setting Common Labels in Kustomize
- 10. Using Overlays
- Example: Basic Overlay Structure
- Example: Overlay kustomization.yaml
- Example: Patch Deployment
- 11. Configuring Image Tags
- Example: Override image tag in Kustomization
- 12. Building Kustomize Output
- Example: Basic kustomize build command
- Example: Building with output to file
- Example: Building with Helm support
Implementing GitOps
- 1. Understanding GitOps Principles
- Example: GitOps Workflow
- Core GitOps Concepts
- 2. Installing Flux
- Example: Install Flux CLI
- Installation Steps
- 3. Installing ArgoCD
- Example: Install ArgoCD using Helm
- Installation Steps
- 4. Creating GitRepository Source
- Example: GitRepository with branch reference
- Example: GitRepository with tag reference
- 5. Creating Kustomization
- Example: Creating a Kustomization resource
- 6. Creating ArgoCD Application
- Example: ArgoCD Application Manifest
- 7. Configuring Auto-Sync
- Example: Auto-Sync Configuration
- 8. Managing Helm Releases
- Example: Installing a Helm Release
- Example: Upgrading a Helm Release
- Example: Rolling Back a Helm Release
- 9. Monitoring Sync Status
- Example: Check Application Sync Status
- 10. Troubleshooting Sync Issues
- Example: Debugging a failed sync
Using Advanced kubectl Techniques
- 1. Using JSONPath Queries
- Example: Filtering Pods by Label
- Example: Getting Container Image Names
- 2. Using Custom Columns
- Example: Custom Columns with kubectl get
- 3. Formatting Output
- Example: Custom Columns Output
- Example: Filtering Pods by Node Name
- 5. Using Label Selectors
- Example: Label Selectors in kubectl
- 6. Performing Bulk Operations
- Example: Apply Configuration to Multiple Resources
- Example: Update Labels on Multiple Pods
- Example: Delete Multiple Resources by Label
- 7. Using kubectl patch
- Example: Patching a Deployment's Replicas
- Example: Patching with Strategic Merge
- 8. Creating Resources from stdin
- Example: Creating a Pod from stdin
- 9. Using kubectl diff
- Example: Comparing a Deployment Configuration
- 10. Using kubectl wait
- Example: Waiting for a Pod to be Ready
- Example: Waiting for a Deployment to be Available
- 11. Creating Dry Runs
- Example: Dry Run Deployment
- 12. Using kubectl explain
- Example: Explaining a Pod resource
- Example: Explaining a specific field in a Pod
Debugging and Troubleshooting Pods
- 1. Viewing Pod Logs
- Example: Retrieve logs from a pod
- Example: Follow logs in real-time
- Example: Retrieve logs from a specific container
- 2. Following Log Streams
- Example: Follow logs from a pod
- Example: Follow logs from a specific container in a pod
- 3. Viewing Previous Container Logs
- Example: View Previous Logs
- 4. Executing Commands in Pods
- Example: Running a command in a pod
- Example: Running a command in a specific container
- 5. Creating Debug Containers
- Example: Creating a Debug Container
- 6. Using Ephemeral Containers
- Example: Adding an Ephemeral Container
- 7. Viewing Pod Events
- Example: Get Pod Events
- Example: Get Events for Specific Pod
- 8. Using Port Forwarding
- Example: Forwarding a Local Port to a Pod
- 9. Inspecting API Objects
- Example: Inspecting a Pod's Details
- Example: Getting Raw YAML of a Pod
- 10. Checking Cluster Events
- Example: Viewing Events for a Specific Pod
- Example: Inspect Pod Network Interfaces
- Workflow: Diagnose Pod Network Issues
- 12. Using Node Debug Pods
- Example: Create debug pod on node
Analyzing Resource Usage
- 1. Installing Metrics Server
- Example: Install Metrics Server via kubectl
- 2. Viewing Node Metrics
- Example: Fetching Node Metrics via kubectl
- 3. Viewing Pod Metrics
- Example: Get Pod CPU and Memory Usage
- Example: Get All Pods' Metrics
- 4. Viewing Container Metrics
- Example: Fetching Pod Metrics
- 5. Sorting by Resource Usage
- Example: Sort pods by CPU usage
- Example: Sort nodes by memory usage
- 6. Using Prometheus
- Example: Querying CPU Usage
- Example: Setting up a Prometheus Rule
- 7. Creating Grafana Dashboards
- Example: Basic Kubernetes Metrics Dashboard
- 8. Setting Up Alerts
- Example: Prometheus Rule for CPU Usage
- Example: Alertmanager Configuration
- Alerting Workflow Overview
- 9. Using kube-state-metrics
- Example: Collecting Pod Metrics
- 10. Monitoring Control Plane
- Example: Collecting API Server Metrics
Implementing Centralized Logging
- 1. Installing Fluentd DaemonSet
- Example: Deploying Fluentd DaemonSet
- 2. Configuring Elasticsearch
- Example: Elasticsearch Configuration in Kubernetes
- 3. Configuring Kibana
- Example: Basic Kibana Configuration
- Key Configuration Points
- 4. Setting Up Log Forwarding
- Example: Forwarding Logs to Elasticsearch
- Key Considerations
- 5. Using Loki for Logging
- Example: Deploying Loki with Grafana
- Example: Configuring Fluentd to Send Logs to Loki
- Key Features of Loki
- 6. Installing Promtail
- Example: Installing Promtail via Helm
- Example: Installing Promtail via Manifests
- 7. Querying Logs with LogQL
- Example: Basic Log Query
- Example: Aggregating Logs by Level
- Example: Rate of Log Entries
- 8. Setting Log Retention Policies
- Example: Configuring Log Retention in Fluentd
- 9. Configuring Structured Logging
- Example: Structured Logging Configuration
- 10. Troubleshooting Logging Stack
- Common Logging Issues and Solutions
- Example: Check Logging Agent Status
- Example: Validate Log Format in Agent Config
Implementing Service Mesh
- 1. Understanding Service Mesh Concepts
- Example: Service Mesh Architecture
- Core Components
- Service Mesh vs API Gateway
- 2. Installing Istio
- Example: Install Istio using istioctl
- Installation Steps
- 3. Installing Linkerd
- Example: Install Linkerd CLI
- Installation Summary
- 4. Enabling Sidecar Injection
- Example: Enable Sidecar Injection on a Namespace
- Example: Enable Sidecar Injection on a Pod
- 5. Configuring Traffic Management
- Example: Route traffic based on headers
- Example: Set timeout and retries
- 6. Implementing mTLS
- Example: mTLS Configuration in Istio
- 7. Configuring Request Routing
- Example: Basic Route Configuration
- Example: Route with Header Matching
- 8. Implementing Circuit Breaking
- Example: Configuring Circuit Breaker in Istio
- 9. Observing Service Mesh
- Example: Grafana Dashboard Setup
- Example: Jaeger Trace Sampling
- Key Observability Concepts
- 10. Troubleshooting Service Mesh
- Common Service Mesh Troubleshooting Steps
- Example: Inspecting Proxy Logs
- Service Mesh Troubleshooting Checklist
Managing Multi-Tenancy
- 1. Creating Tenant Namespaces
- Example: Create a Tenant Namespace
- 2. Setting Resource Quotas
- Example: Resource Quota Definition
- 3. Configuring Limit Ranges
- Example: Define LimitRange for Namespace
- 4. Implementing RBAC Isolation
- Example: Creating a Role for Pod Access
- Example: Binding Role to User
- 5. Using Network Policies
- Example: Basic Network Policy
- Example: Deny All Ingress
- Example: Allow From Specific Namespace
- 6. Configuring Pod Security
- Example: Applying Pod Security Standard
- Example: Enforcing Restricted Policy
- 7. Using Virtual Clusters
- Example: Creating a Virtual Cluster with Namespaces
- Virtual Clusters vs. Dedicated Clusters
- 8. Implementing Hierarchical Namespaces
- Example: Creating a Hierarchical Namespace
- Best Practices for Hierarchical Namespaces
- 9. Monitoring Tenant Resources
- Example: Querying CPU Usage for a Namespace
- Key Metrics to Monitor
- 10. Implementing Cost Allocation
- Example: Labeling Namespaces for Cost Tracking
- Example: Setting Resource Limits
- Example: Configuring Horizontal Pod Autoscaler
Implementing Backup and Disaster Recovery
- 1. Installing Velero
- Example: Installing Velero CLI
- Example: Installing Velero Server with AWS
- 2. Configuring Backup Storage
- Example: Configuring a Persistent Volume for Backup Storage
- Example: Using Cloud Storage with AWS S3
- 3. Creating Backups
- Example: Backup etcd
- Example: Backup ConfigMaps and Secrets
- 4. Scheduling Backups
- Example: Cron Schedule
- Example: Backup Template
- 5. Restoring from Backup
- Example: Restore a Kubernetes StatefulSet from Backup
- Workflow: Restore Process Steps
- Summary of Restoration Considerations
- 6. Backing Up Specific Namespaces
- Example: Backup a Specific Namespace
- Example: Restore a Specific Namespace
- 7. Excluding Resources
- Example: Excluding a Deployment from Backup
- 8. Using Backup Hooks
- Example: Using Backup Hooks in a CronJob
- 9. Migrating Across Clusters
- Example: Migrating a Deployment
- 10. Monitoring Backup Status
- Example: Check Backup Status
- Example: Check Restore Status
- 11. Troubleshooting Backups
- Common Backup Issues and Resolution Steps
- Example: Debugging Backup Job Logs
Managing Cluster Upgrades
- 1. Planning Cluster Upgrades
- Upgrade Planning Steps
- Upgrade Strategies
- 2. Upgrading Control Plane
- Example: Upgrade Control Plane Components
- 3. Upgrading Worker Nodes
- Example: Drain and Upgrade Worker Node
- 4. Upgrading kubectl
- Example: Install kubectl v1.29
- 5. Upgrading Managed Clusters
- Example: GKE Cluster Upgrade
- Upgrade Considerations
- 6. Using Blue-Green Strategy
- Example: Deploying with Blue-Green Strategy
- Deployment Workflow
- Benefits of Blue-Green Deployment
- 7. Performing Rolling Upgrades
- Example: Performing a Rolling Upgrade
- 8. Testing Before Upgrade
- Example: Pre-upgrade testing with kubectl
- Pre-Upgrade Checklist
- 9. Rolling Back Upgrades
- Example: Rolling Back a Deployment
- 10. Monitoring Upgrade Progress
- Example: Monitoring etcd leader changes
Optimizing Cluster Performance
- 1. Optimizing API Server
- Example: API Server Configuration
- 2. Tuning etcd Performance
- Example: etcd Configuration in kube-apiserver
- 3. Optimizing Node Resources
- Example: Resource Requests and Limits in a Pod Spec
- 4. Configuring DNS Optimization
- Example: Configuring CoreDNS with Custom Upstream Servers
- Example: Enabling Cache in CoreDNS
- 5. Using Node Local DNS Cache
- Example: Enabling NodeLocal DNS in Helm Values
- 6. Reducing Image Pull Time
- Example: Optimizing Image Pull Policy
- Example: Using Image Pull Secrets
- 7. Optimizing Pod Startup
- Example: Pod with optimized startup settings
- 8. Using Pod Priority
- Example: Setting Pod Priority
- 9. Right-Sizing Resources
- Example: Right-sizing a Deployment
- 10. Monitoring Cluster Performance
- Example: Querying CPU Usage with Prometheus
- Example: Monitoring Memory Usage in Grafana
Implementing Security Best Practices
- 1. Implementing Network Segmentation
- Example: Network Policy for Frontend to Database
- 2. Enabling RBAC Authorization
- Example: Role for Pod Access
- 3. Using Pod Security Standards
- Example: Enforce Restricted Standard
- 4. Scanning Container Images
- Example: Trivy Scan Output
- 5. Enabling Secrets Encryption
- Example: Secrets Encryption Config
- 6. Using Admission Controllers
- Example: Admission Controller Configuration
- 7. Enabling Audit Logging
- Example: Audit Log Configuration
- 8. Implementing mTLS
- Example: mTLS Configuration in Istio
- 9. Rotating Certificates
- Example: Renewing Certificates
- 10. Running CIS Benchmarks
- Example: CIS Benchmark Scan
- 11. Using Runtime Security
- Example: Falco Rule for Suspicious Activity
- 12. Implementing Supply Chain Security
- Example: Supply Chain Policy Enforcement
Implementing Cost Optimization
- 1. Right-Sizing Resources
- Example: Resource Configuration
- Right-Sizing Best Practices
- 2. Using Spot Instances
- Example: Spot Instance Configuration
- 3. Implementing Cluster Autoscaler
- Example: Cluster Autoscaler Deployment Configuration
- Example: Node Group Tagging for Discovery
- 4. Configuring Pod Disruption Budgets
- Example: Basic PDB Configuration
- Key Points
- 5. Using Vertical Pod Autoscaler
- Example: VPA Configuration
- Example: Resource Recommendation
- 6. Scheduling Workloads Efficiently
- Example: Node Affinity Configuration
- Example: Tolerations for Master Node
- Key Concepts
- 7. Implementing Resource Quotas
- Example: Setting Resource Limits in a Pod
- Example: Creating a ResourceQuota in a Namespace
- 8. Using Storage Classes Wisely
- Example: Creating a StorageClass with optimized settings
- 9. Cleaning Up Unused Resources
- Example: Delete Unused Deployment
- Example: Delete Unused Service
- 10. Monitoring Cost Allocation
- Example: Resource Quotas
- Key Points
Working with Multi-Cluster Federation
- 1. Understanding Multi-Cluster Patterns
- Example: Active-Active Cluster Setup
- Key Considerations
- 2. Installing KubeFed
- Example: Install KubeFed using kubectl
- Installation Steps
- 3. Creating Federated Clusters
- Example: Federated Cluster Configuration
- 4. Deploying Federated Resources
- Example: Deploying a Federated Deployment
- 5. Configuring Placement Policies
- Example: Placement Policy with Cluster Affinity
- 6. Implementing Cross-Cluster Discovery
- Example: Federated Service Configuration
- 7. Using Multi-Cluster Ingress
- Example: Basic Multi-Cluster Ingress Configuration
- Key Considerations for Multi-Cluster Ingress
- 8. Configuring Context Switching
- Example: Define a new context in kubeconfig
- Example: Switch context using kubectl
- Example: View current context
- 9. Implementing Disaster Recovery
- Example: Backup etcd
- Example: Restore etcd from Snapshot
- Disaster Recovery Steps
- 10. Monitoring Federated Clusters
- Example: Setting up Prometheus Federation for Multi-Cluster Metrics
- Monitoring Tools Comparison