kubernetes-infra.atakangul.com Open in urlscan Pro
2606:4700:3037::ac43:a6ad  Public Scan

URL: https://kubernetes-infra.atakangul.com/
Submission: On September 23 via api from US — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

CLOUD AGNOSTIC DESIGN USING TERRAFORM, KUBERNETES, HELM, AND JENKINS

Achieving Scalable and Flexible Deployment Pipelines




INTRODUCTION TO CLOUD AGNOSTIC DESIGN

 * Designing applications and infrastructure to run across multiple cloud
   providers with minimal changes
 * Key Technologies:
   * Terraform: Infra setup
   * Kubernetes: Container orchestration
   * Helm: Kubernetes package manager
   * Jenkins: CI/CD automation


CLOUD AGNOSTIC ARCHITECTURE WITH TERRAFORM

Abstracts away the infra setup details and provides the flexibility of choosing
any cloud provider for your services.
AWS
Azure
GCP

Kubernetes Cluster
Monitoring Namespace
Prometheus
Grafana
Exporters
Staging Namespace
Awaiting Jenkins Tests
Production Namespace
Web App
Worker
MongoDB


JENKINS PIPELINE STAGES

Code Checkout
Helm Chart Setup
Version Management
Docker Build & Push
Staging Deploy
Testing
Approval
Production Deploy


JENKINS PIPELINE STAGES

Code Checkout
Helm Chart Setup
Version Management
Docker Build & Push
Staging Deploy
Testing
Approval
Production Deploy


CODE CHECKOUT STAGE

Purpose: Ensure the pipeline uses the latest code version

stage('Checkout Application') {
    steps {
        // Clone the application repository
        git url: 'https://github.com/AtakanG7/web-app', branch: 'main'
        // This step fetches the latest code from the specified Git repository
    }
}
            


HELM CHART REPOSITORY SETUP

Purpose: Prepare Helm charts for deployment

stage('Clone Helm Chart Repository') {
    steps {
        // Clone the Helm chart repository
        sh "git clone ${HELM_REPO} helm-repo"
        // Add the Helm chart repository to the local Helm installation
        sh "helm repo add myrepo https://atakang7.github.io/gh-pages/docs"
        // These steps ensure that the necessary Helm charts are available for deployment
    }
}
            


CHART VERSION MANAGEMENT

Purpose: Ensure correct versioning of the application

stage('Update Chart Versions') {
    steps {
        script {
            dir('helm-repo') {
                // Increment the version number
                env.NEW_VERSION = incrementVersion(currentVersion)
                // Update the Chart.yaml file with the new version
                sh "sed -i 's/version: .*/version: ${env.NEW_VERSION}/' ${CHART_PATH}/Chart.yaml"
                // This ensures that each deployment has a unique version number
            }
        }
    }
}
            


DOCKER IMAGE BUILD AND PUSH

Purpose: Prepare containerized application for deployment

stage('Build and Push Docker Image') {
    steps {
        script {
            // Build the Docker image with the new version tag
            sh "docker build -t atakan1927/web-app:${env.NEW_VERSION} ."
            // Push the newly built image to the Docker registry
            sh "docker push atakan1927/web-app:${env.NEW_VERSION}"
            // These steps create a new container image and make it available for deployment
        }
    }
}
            


STAGING DEPLOYMENT

Purpose: Test new version in a controlled environment

                stage('Mirror Production in Staging') {
                    steps {
                        script {
                            dir('helm-repo') {
                                def charts = sh(script: "ls charts", returnStdout: true).trim().split()
                                for (def chart in charts) {
        
                                    sh """
                                        helm upgrade --install ${chart}-staging charts/${chart} \
                                            --namespace staging \
                                            -f charts/${chart}/values-staging.yaml \
                                            --wait
                                    """
                                    
                                }
                            }
                        }
                    }
                }
            


TESTING STAGE

Purpose: Ensure application quality and functionality

stage('Run Tests') {
    steps {
        echo "Running tests on staging environment..."
        // This is a placeholder for actual testing commands
        // In a real scenario, you would run various tests here to verify the application's functionality
    }
}
            


PRODUCTION APPROVAL AND DEPLOYMENT

Purpose: Human validation before live deployment

stage('Approval') {
    steps {
        // Wait for manual approval before proceeding
        input message: 'Approve deployment to production?', ok: 'Deploy'
        // This step requires human intervention to ensure that the deployment is ready for production
    }
}

stage('Deploy to Production') {
    steps {
        script {
            sh """
                # Use Helm to upgrade or install the application in the production environment
                helm upgrade --install ${APP_NAME} ${CHART_PATH} \
                    --namespace production \
                    -f ${CHART_PATH}/values-production.yaml \
                    --set image.tag=${env.NEW_VERSION}
                # This command deploys the approved version to the production environment
            """
        }
    }
}
            


CLOUD AGNOSTIC BENEFITS

 * Multi-cloud Compatibility
 * Scalability
 * Flexibility
 * Consistency


MONITORING

 * Prometheus
 * Grafana
 * Scrapers
 * If more information needed about the network. Istio may be implemented


CONCLUSION

 * Kubernetes, Helm, and Jenkins create an efficient, flexible, cloud-agnostic
   pipeline
 * Enables easy scaling and management across multiple environments
 * Reduces vendor lock-in and increases deployment flexibility


Q&A

Thank you for your attention!

Previous Next