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.
-
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
- Production Environment
- A K8s cluster set up for production environment using AWS EKS service. You can follow this link to create your own cluster: Set up to use Amazon EKS
- Kubernetes clusters: Ensure you have a K8s clusters set up for staging and production environments.
kubectl: Install and configurekubectlto interact with your K8s cluster.
→ you need to configure the config file in.kubefolder after installingkubectltool. Follow the instructions here.- Jenkins: Set up Jenkins for CI/CD pipelines to deploy the application to K8s clusters.
- SonarQube: Configure SonarQube for code quality analysis in the CI/CD pipeline.
- Trivy: Integrate Trivy for scanning Docker images for vulnerabilities.
- Clone the repository:
git clone https://github.com/NT114-O21-DACN-DevOps/class-management-k8s-config.git
cd class-management-k8s-config- Apply the manifests
- Because of using
kustomizationfile, you only need to apply all of the config files with 1 command:
kubectl apply -k .- Prepare Jenkins Pipeline
- Add the necessary credentials for accessing the K8s clusters, GitHub repository, SonarQube, and other services.
- Create a new pipeline in Jenkins
- Create a new pipeline and configure the pipeline script to deploy the application to the K8s clusters.
- You can use the
Jenkinsfilein this repository as a reference for the pipeline script.
- Run the Jenkins Pipeline
- Run the Jenkins pipeline to deploy the application to the staging and production environments.
- Ensure that the
configMap.yamlandsecret.yamlfiles contain appropriate configurations and sensitive data for each environment. - Update
ingress.yamlwith the correct rules for routing external traffic to your services. - Review the
persistentVolume.yamlto configure persistent storage as required by your application.






