Posts

Showing posts with the label gcp

Kubernetes ConfigMap and Secret

Image
Introduction This article will guide you on how to use ConfigMap and Secret to pass environment variables. As you know, during software development, you need to deploy on different environments such as development, staging, and production. We aim to use the same codebase across these environments but sometimes need to pass different environment variables for specific configurations. Kubernetes (K8s) supports ConfigMap and Secret to address this need. If you've used Docker before, configuring environment variables in K8s will feel similar. ConfigMap is an object that stores data in key-value pairs, intended for non-sensitive information (i.e., values that can be displayed when viewing the configuration of K8s resources). Supported data types include number , boolean , and string (it can store a string of characters or the contents of a text file). Secret has several types, with type=Opaque being the most commonly used. It works similarly to ConfigMap but is used for sensit...

Using Kubernetes Ingress to navigate traffic to Services

Image
Introduction In the previous article, I introduced the basic concepts of Kubernetes Ingress , and how to use Ingress along with related components ( Nginx Ingress Controller and cert-manager ) to automatically issue TLS certificates when deploying HTTPS applications . In this article, I'll show you how to define rules in Ingress to route traffic to different Services based on your needs. Prepare Docker Image First, you'll need a Docker image to get started. You can either use two different Docker images or follow my next instructions to prepare a Docker image . Here's a code block to create a NodeJS server that displays a title based on an environment variable input: import express from 'express' const port = 3000 const title = 'This is NodeJS Typescript Application' const app = express () app . get ( '/' , ( _ , res ) => { res . send (( process ?. env ?. TITLE ?? title ) + '! Current time is ' + Date . now ()) ...

Deploying HTTPS with Kubernetes Nginx Ingress and Cert Manager

Image
Introduction This article will guide you through using Nginx Ingress Controller and Cert Manager on Kubernetes (K8s) to automatically issue TLS (Transport Layer Security) certificate . To follow along, you'll need: Basic knowledge of Google Kubernetes Engine for cluster initialization Understanding of K8s Deployment, Service to deploy applications Familiarity with Helm for installing necessary charts. Ingress Ingress is a Kubernetes resource used to manage external access to Services within a cluster . It acts like a traffic router, allowing you to define routing configurations to efficiently manage incoming traffic to Services . Ingress Controller An Ingress Controller is a distinct component from Ingress itself. There are various types of Ingress Controllers , each capable of different deployments. However, their main function is to manage and deploy according to Ingress rules . When requests reach Ingress, the Ingress Controller uses these defined rules to route traffic...

Automating Server Configuration with Ansible

Image
Introduction Ansible is an open-source IT automation tool written in Python . It's widely used for configuration management, making complex tasks simpler by automating system setup, software deployment, and more. Ansible is agentless , meaning it doesn't require an agent to communicate with other machines. It supports a wide range of operating systems, platforms, and devices, from Ubuntu and VMware to CentOS , Windows , Azure , AWS , and network devices like Cisco and Juniper . This design increases Ansible's usability because you don't need to install and maintain agents on hosts. This is a significant advantage over similar tools like Chef , SaltStack , and Puppet . Why Choose Ansible? Here are some reasons to choose Ansible over other configuration management tools: Open Source : It's free to use. Uses SSH : Easily connects directly to servers. Lightweight : Easy to set up and doesn't consume many resources. Readable Syntax : Uses YAML for scripts, ma...