Skip to content

NT114-O21-DACN-DevOps/class-management-k8s-config

Repository files navigation

Kubernetes Configuration

🛈 Overview

This repo contains Kubernetes configuration files used for deploying the application to staging and production environments. The configuration is organized into modules for each service, including both front-end and back-end services.

🧰 Components

  • Manifests:

    • deployment.yaml: Defines the deployment configurations for the service.
    • service.yaml: Specifies the service configuration for exposing the deployment.
    • secret.yaml: Contains sensitive data which should be stored as base64 type.
    • configMap.yaml: Stores non-confidential data in key-value pairs.
    • ingress.yaml: Configures ingress rules for external access to the services.
    • persistentVolume.yaml: Defines persistent storage volumes.
    • kustomization.yaml: Create variations of K8s resources and configurations for specific use cases.
  • Staging Environment

    • A K8s cluster set up for staging environment using Terraform & Ansible with kubeadm tool. I already have a repo that sets up the cluster like the architecture below 👉 Here

Stag Environment

  • Production Environment

Prod Environment

🚀 Getting Started

Prerequisites

  • Kubernetes clusters: Ensure you have a K8s clusters set up for staging and production environments.
  • kubectl: Install and configure kubectl to interact with your K8s cluster.
    → you need to configure the config file in .kube folder after installing kubectl tool. Follow the instructions here.

Setup

  1. Clone the repository:
git clone https://github.com/NT114-O21-DACN-DevOps/class-management-k8s-config.git
cd class-management-k8s-config
  1. Apply the manifests
  • Because of using kustomization file, you only need to apply all of the config files with 1 command:
kubectl apply -k .

Notes

  • Ensure that the configMap.yaml and secret.yaml files contain appropriate configurations and sensitive data for each environment.
  • Update ingress.yaml with the correct rules for routing external traffic to your services.
  • Review the persistentVolume.yaml to configure persistent storage as required by your application.