Giter Site home page Giter Site logo

gitops-sample's Introduction

GitOps Sample

This is a sample project to demonstrate GitOps with ArgoCD.

Instructions

  1. Create a K8s cluster

  2. Install ingress-nginx

    helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
    helm repo update
    helm install ingress-nginx ingress-nginx/ingress-nginx --create-namespace --namespace ingress-nginx
  3. Get the nginx loadbalancer service's external IP

    $ kubectl get svc -n ingress-nginx
    NAME                                 TYPE           CLUSTER-IP      EXTERNAL-IP     PORT(S)                      AGE
    ingress-nginx-controller-admission   ClusterIP      10.43.132.65    <none>          443/TCP                      3m12s
    ingress-nginx-controller             LoadBalancer   10.43.172.201   **74.220.19.189**   80:31297/TCP,443:32408/TCP   3m12s

    Add a DNS entry of A type for your domain (in this case: gitops.arshsharma.com) to point to this IP.

  4. Install ArgoCD

    kubectl create namespace argocd
    kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

    To access the Argo CD UI:

    kubectl port-forward svc/argocd-server -n argocd 8080:443

    Login to localhost:8080 with username admin and password you get via running:

    kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d

    Or if you have argocd CLI installed, you can run:

    argocd admin initial-password -n argocd

    This is supposed to be a one time use password and it is recommended you change this.

  5. Click New App from the Argo CD UI and click edit as YAML and copy paste the config in /apps/go-server-prod.yaml and click create. And then click sync.

    Now we are at the stage when if you change the tag in chart/values.yaml and commit and push, Argo CD will detect that its out of sync and you can click sync from the UI to sync it.

  6. Next step is to automate things and for that we will use GitHub Actions. Create a DockerHub token and the following repo secrets in GitHub:

    • DOCKERHUB_USERNAME
    • DOCKERHUB_TOKEN
  7. In the repo settings -> Actions -> General -> Workflow permissions -> Give it read and write permissions so that our action can commit changes to the repo.

Since this is a mono repo example we would have to do:

git fetch origin   
git rebase origin/main

It is ideal to separate the application code and application config in different repos.

gitops-sample's People

Contributors

rinkiyakedad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.