Code2Deploy

Blog

Practical, hands-on guides on Kubernetes, DevOps, cloud infrastructure, security, and AI/LLMOps — written from real production work.

Kubernetes

Exposing a Kubernetes Service Using a Custom Domain

Scenario You have a Kubernetes service and want to expose it using a custom domain (e.g., myapp.example.com). This requires configuring an Ingress controller and setting up DNS properly. Solution: Using Ingress with a Custom Domain An Ingress resource allows HTTP and HTTPS traffic routing to your services based on defined rules. Example: NGINX Ingress Steps…

Kubernetes

Enforcing Resource Limits at the Namespace Level in Kubernetes

Introduction In multi-tenant Kubernetes clusters, enforcing resource limits at the namespace level is crucial to prevent excessive resource consumption by certain workloads. This ensures fair resource distribution, avoids overloading nodes, and enhances cluster stability. In this blog, we will cover: Understanding ResourceQuota A ResourceQuota restricts the total resource consumption within a namespace. It applies to…

Database

MySQL Slow Queries: Causes, Analysis, and Optimization

Introduction MySQL slow queries can cause performance bottlenecks in your application, leading to slow response times and high server loads. Identifying and optimizing slow queries is essential for maintaining database efficiency and ensuring a smooth user experience. In this blog, we’ll cover: What Are MySQL Slow Queries? A slow query is a SQL query that…

Deployment

Scheduling a Pod on a Specific Node in Kubernetes

Introduction In Kubernetes, controlling where a pod runs is essential for optimizing performance, ensuring high availability, and meeting specific hardware or compliance requirements. You can achieve this using nodeSelector and nodeAffinity. In this blog, we will cover: Using nodeSelector for Simple Scheduling The nodeSelector field allows you to specify a key-value pair that a node…

Kubernetes

Securely Managing Application Configuration with Kubernetes Secrets and ConfigMaps

Introduction When deploying applications in Kubernetes, managing configuration data securely and efficiently is critical. Kubernetes provides Secrets for handling sensitive data like passwords and API keys, and ConfigMaps for storing non-sensitive configuration data such as environment variables and application settings. In this blog, we’ll explore: Using Kubernetes Secrets for Secure Data Management Secrets in Kubernetes…

Kubernetes

Deploying Without Downtime in Kubernetes

Introduction Ensuring zero downtime during deployment updates is a crucial requirement for modern applications. Kubernetes provides a RollingUpdate strategy that allows you to update applications seamlessly without disrupting users. Why Use Rolling Updates? A rolling update gradually replaces old pods with new ones, ensuring that your application remains available during deployment. Key features: Example: Kubernetes…

k8s Storage

Sharing Data Between Containers in a Multi-Container Pod

Introduction In Kubernetes, a Pod can contain multiple containers that need to share data with each other. Unlike inter-process communication (IPC) or networking, sharing data using volumes allows efficient and persistent storage within a pod. Scenario Imagine you have a logging system where one container generates logs, and another container processes those logs in real…

Kubernetes

Kubernetes Resource Management and Autoscaling: Best Practices

In modern cloud-native applications, efficient resource allocation and autoscaling are crucial to optimizing performance and cost. Kubernetes provides robust mechanisms for managing pod resources and automatically scaling workloads. This blog will explore how to configure resource requests, limits, and both Horizontal and Vertical Pod Autoscaler (HPA and VPA) with practical examples. Understanding Resource Requests and…

Installing Rancher on K3s with Ingress, Domain, and SSL Configuration
Kubernetes Basic

Installing Rancher on K3s with Ingress, Domain, and SSL Configuration

In this tutorial, we’ll walk through the process of setting up Rancher on a K3s cluster. We’ll cover prerequisites like setting up an Ingress Controller, configuring a Domain Name, enabling SSL with Let’s Encrypt, and editing the agent-tls-mode before registering your existing cluster to Rancher. Prerequisites Step 1: Install K3s If you don’t already have…