Skip to content

This repository showcases the implementation of GitOps principles for continuous deployment using Argo CD. Additionally, it explores the concepts of canary deployments with Argo Rollouts (implementation may be limited due to local machine resource constraints).

Notifications You must be signed in to change notification settings

puneet-khatri/Flask-Docker-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DevOps Internship Assignment: GitOps with Argo CD and Canary Rollouts

This document details the steps taken to complete the DevOps internship assignment, focusing on GitOps principles, Argo CD for continuous deployment, and Argo Rollouts for advanced deployment strategies. Due to resource limitations on the local machine, the canary release tasks (Task 3) were not fully executed. However, explanations and potential solutions are provided.

Development Environment Setup

The development environment was set up following the instructions outlined in the project's README file at https://github.com/ondiekelijah/Flask-Docker-App. This involved creating a virtual environment, installing dependencies, and preparing the application code.

Task 1: Setup and Configuration

This section details the initial setup steps required to complete the DevOps internship assignment.

1.1 Local Environment Preparation

  • Prerequisites:
    • Basic understanding of Kubernetes concepts (Pods, Deployments, Services)
    • Familiarity with Docker and containerization principles
    • Experience with Git for version control
  • Minikube Installation: We used Minikube to create a single-node Kubernetes cluster on the local machine. Follow the official Minikube installation guide for your operating system: https://minikube.sigs.k8s.io/docs/start/
    • After installation, verify Minikube is running with the command minikube status.

1.2 Docker Installation

1.3 Git Repository

  • A Git repository was created on [Platform (e.g., GitHub, GitLab)] to host the source code for the web application and the Kubernetes deployment manifests.

1.4 Argo CD Installation

1.5 Argo Rollouts Installation

Task 2: Creating the GitOps Pipeline

This section details the process of building a GitOps pipeline for automated deployment using Argo CD.

2.1 Dockerizing the Web Application

  • A sample Flask web application was chosen for this assignment (Cloned a simple flask repository).
  • A Dockerfile was created to build a Docker image for the web application. The Dockerfile likely included instructions for:
    • Setting up the base image (e.g., Python)
    • Installing dependencies
    • Copying the application source code
    • Exposing the application port
    • Defining the application entry point (e.g., the Flask command)
  • The Docker image was built and pushed to a public container registry (details in the repository).

2.2 Deployment with Argo CD

  • The Kubernetes deployment manifests were modified in the Git repository to reference the pushed Docker image. These manifests typically include:
    • Deployment definition: Specifying the container image, replicas, and other deployment configurations.
    • Service definition: Exposing the deployment externally through a Service object with a load balancer or NodePort type.
  • Once the updated manifests were committed and pushed to the Git repository, Argo CD automatically detected the changes and deployed the updated application to the Kubernetes cluster.

Challenges and Solutions:

1. Setting Up a Kubernetes Cluster:

  • Limited Cloud Resources: Exploring cloud-based Kubernetes offerings like Google Kubernetes Engine (GKE) and Azure Kubernetes Service (AKS) revealed paywall restrictions during the free trial period. This highlights the importance of considering resource costs during cloud provider selection.
  • Minikube Installation: While initial attempts at installing Minikube on Windows were unsuccessful due to compatibility limitations, successfully migrating to a Linux environment (Ubuntu) ensured proper functionality. This emphasizes the system requirements for running Minikube.

2. Docker Configuration and Image Management:

  • Docker Permissions: A "permission denied" error surfaced while working with Docker. The solution involved adding the user to the Docker group, granting the necessary permissions. This underlines the importance of appropriate user permissions for Docker operations.
  • Pushing Docker Image to Registry: Initially, an "unable to find image locally" error occurred when pushing to Docker Hub. This was resolved by creating a repository on Docker Hub and tagging the local image with the repository name before pushing. This emphasizes the proper workflow for pushing Docker images to a registry.

3. AMD Virtualization Conflict:

  • Minikube and Docker Desktop Resource Conflict: An AMD-V virtualization error arose due to conflicting resource usage between Minikube and Docker Desktop. Closing Docker Desktop freed up the necessary resources for Minikube to function. This highlights the potential for resource conflicts between containerization tools and virtual machine management software.

4. Argo CD Connection Timeout:

  • Challenge: A persistent connection timeout occurred when accessing the Argo CD web interface. This could be attributed to various factors, including:

    • Low System Resources: Insufficient RAM or CPU on the local machine might hinder smooth operation of both Minikube and Argo CD.
    • Network Connectivity Issues: Firewall rules, DNS misconfigurations, or other network-related problems could prevent communication with Argo CD.
    • Argo CD Configuration: In rare cases, issues within the Argo CD deployment itself might cause connection problems.
  • Potential Solutions (for future exploration):

    • Resource Optimization: System resources like RAM and CPU should be sufficient to effectively run both Minikube and Argo CD.
    • Network Troubleshooting: Verify network connectivity between the local machine and the Minikube cluster. This might involve examining firewall rules and DNS settings.

Task 3: Implementing a Canary Release with Argo Rollouts (Limited by Local Resources)

Due to resource constraints on the local development machine, a full implementation of a canary release with Argo Rollouts wasn't feasible. These limitations, as i experienced during deployment, could include:

  • Limited CPU/Memory Availability: Minikube and Argo CD require a certain amount of system resources to run effectively. A low-end machine might struggle to handle both simultaneously while maintaining stability.
  • Thermal Throttling: As mentioned, overheating every 15 minutes indicates potential resource limitations on the laptop. This can significantly impact the performance of Minikube and Argo CD, hindering the stability required for a canary release.

While I were able to complete some initial steps, such as configuring Argo Rollouts and modifying the deployment manifest, resource limitations ultimately prevented a full canary release execution.

3.1 Attempted Steps:

  • Argo Rollouts Configuration: I attempted to configure the Argo Rollouts controller in my Minikube cluster, but resource limitations might have caused issues.
  • Deployment Manifest Update: I also modified the deployment manifest to leverage Argo Rollouts, but resource constraints might have prevented further progress This likely involved adding annotations and rollout strategy definitions specifying traffic routing and health checks. However, resource constraints might have prevented further progre

Task 4: Cleanup

4.1 Removing Resources from the Kubernetes Cluster

Once the assignment is complete, it's essential to clean up any resources created within the Kubernetes cluster. Here's how to achieve this:

  1. Identify Resources:

    Use the kubectl get all -A command to list all resources across all namespaces in the cluster. This provides a comprehensive overview of the resources created during the assignment.

  2. Delete Resources:

    There are two approaches to removing resources:

    • Selective Deletion: For specific resources like deployments or services, use targeted commands like kubectl delete deployment <deployment-name>. Replace <deployment-name> with the actual name of the deployment to be removed.
    • Namespace-Level Cleanup: If all resources were created within a dedicated namespace, delete the entire namespace using kubectl delete namespace <namespace-name>. Replace <namespace-name> with the name of the dedicated namespace.
  3. Verify Cleanup:

    After deleting the resources, run kubectl get all -A again. This confirms whether the cleanup process was successful and all resources have been removed from the cluster.

Resources:

About

This repository showcases the implementation of GitOps principles for continuous deployment using Argo CD. Additionally, it explores the concepts of canary deployments with Argo Rollouts (implementation may be limited due to local machine resource constraints).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published