Git Product home page Git Product logo

kubernetescode's Introduction

GitOps Project

In this project, we'll combine Jenkins, Git, GitHub, Docker, Kubernetes, and ArgoCD to deploy our Python web application onto a Kubernetes cluster.

PipeLine Flow

1. Developer will push the code to github

2. Jenkins will clone the repository to jenkins environment ,

3. jenkins will Build docker image using Dockerfile that was attached with code,

4. Jenkins will push that image to container registory Dockerhub,

5. Jenkins will retag the image with new image tag on github deployment file

6. Argocd will deploy deployments/pods and service from that manifests files to the kubernetes cluster

alt text

Steps

Step: 1

  • create a kubernetes cluster and virtual machine ( this will be our environment )
  • connect cluster with vm ( you need to be able to access cluster from vm )

Step: 2

  • install docker, openjdk-11 and jenkins in virtual machine as per your operating system

Step: 3

  • start jenkins server and install this plugins to jenkins

    -- SSH
    -- docker
    -- groovy
    -- github, git

Step: 4 ( global credentials )

  • add credential of dockerhub id: dockerhub
    username= <username-of-dockerhub>
    password= <password-of-dockerhub>

  • generate personal access token with scope repo, admin:repo_hook, notification

  • add credential of github id: github
    username= <username-of-github>
    password= <personal-access-token>

( personal access token should have sufficiant permissins to push code on your github repo, admin:repo_hook, notification, )

Step: 5

  • create a pipeline named "buildimage" in jenkins
    • at Build Triggers section select
      GitHub hook trigger for GITScm polling
    • at pipeline section select: Pipeline script from SCM ( Git )
      repository : your repository with Dockerfile, code, and Jenkinsfile
      ( provide credential if your repo is privet )

Step: 6

  • create pipeline named "updatemanifest" in jenkins
    • select This project is parameterized
      name: DOCKERTAG
      default value: latest
    • at pipeline section select: Pipeline script from SCM ( Git )
      repository : your repository with Dockerfile, code, and Jenkinsfile
      ( provide credential if your repo is privet )

( note: Your jenkins vm should have Public IP because we are using webhooks)

Step: 7

  • at your github kubernetescode repository
    settings > Webhooks > Add webhook
    url : <your-jenkins-url/github-webhook/
    example url : http://20.12.17.101:8080/github-webhook/
    ( makeshure your github repo should be upto date )

  • now try to build first "buildimage" pipeline
    ( it should automatically run updatemanifest pipeline )

Step: 8

  • Now we are going to install argocd in our kubernetes cluster using this commands
  kubectl create namespace argocd
  kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
  • change argocd service to LoadBalancer or NodePort for accessing argocd service name : service/argocd-server
kubectl edit service/argocd-server -n argocd
  • default user for argocd will be admin
  • to get password for login to argocd use command linux
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo

( you can also use argocd cli )

Step: 9

  • create app in argocd
    provide this details

Step: 10

  • install git-github to your vm
  • authanticate with your repo using pat
  • clone kubernetescode repo
  • make changes in your code and push it to your repository
  • check that it is deploying ( updating ) application or not

Feedback and suggestions are highly appreciated

Feel free to reach out with any comments or improvements you might have. Thank you for taking the time to explore our GitOps project!"
https://github.com/Meet-S0ni#connect-with-me

Here are some related Repos to get started

kubernetescode's People

Contributors

meet-s0ni avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.