├── .github └── workflows │ └── docker-image.yml ├── README.md ├── argo-cd-setup ├── provider.tf ├── setup.tf └── values │ └── argocd.yaml ├── argocd-cicd-setup ├── Dockerfile ├── application.yaml ├── dev │ ├── deployment.yaml │ └── namespace.yaml ├── project.yaml ├── script │ └── index.html └── ssh-secret.yaml ├── docs ├── cicd2.png └── test.png └── eks-setup ├── READEME.MD ├── eks.tf ├── nat.tf ├── provider.tf ├── route-table.tf ├── subnets.tf ├── variables.tf └── vpc.tf /.github/workflows/docker-image.yml: -------------------------------------------------------------------------------- 1 | name: Deploy to Kubernetes 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | pull_request: 7 | branches: [master] 8 | 9 | env: 10 | DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} 11 | DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} 12 | 13 | jobs: 14 | deploy: 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | # Checkout the code from GitHub repository 19 | - name: Checkout code 20 | uses: actions/checkout@v2 21 | 22 | - name: Login to Docker Hub 23 | uses: docker/login-action@v1 24 | with: 25 | username: ${{ secrets.DOCKER_USERNAME }} 26 | password: ${{ secrets.DOCKER_PASSWORD }} 27 | 28 | # Build Docker image and push it to Docker Hub 29 | - name: Build and push Docker image 30 | run: | 31 | docker build -t ${DOCKER_USERNAME}/my-app:latest -f argocd-cicd-setup/Dockerfile . 32 | docker push ${DOCKER_USERNAME}/my-app:latest 33 | - name: Login to GitHub Packages 34 | uses: actions/checkout@v3 35 | with: 36 | repository: ravindrasinghh/argocd-setup 37 | ref: 'master' 38 | token: ${{ secrets.G_TOKEN }} 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # argocd-setup 2 | # Argo CD - Declarative Continuous Delivery for Kubernetes 3 | 4 | ## What is Argo CD? 5 | 6 | Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes. 7 | 8 | ![Argo CD UI](docs/cicd2.png) 9 | 10 | 11 | ## Why Argo CD? 12 | 13 | 1. Application definitions, configurations, and environments should be declarative and version controlled. 14 | 1. Application deployment and lifecycle management should be automated, auditable, and easy to understand. 15 | 16 | ## Who uses Argo CD? 17 | 18 | [Official Argo CD user list](USERS.md) 19 | 20 | ## Documentation 21 | 22 | To learn more about Argo CD [go to the complete documentation](https://argo-cd.readthedocs.io/). 23 | Check live demo at https://youtu.be/aknJrQH8TMM. 24 | -------------------------------------------------------------------------------- /argo-cd-setup/provider.tf: -------------------------------------------------------------------------------- 1 | provider "helm" { 2 | kubernetes { 3 | config_path = "~/.kube/config" 4 | } 5 | } 6 | terraform { 7 | required_version = ">= 1.0.0" 8 | 9 | required_providers { 10 | helm = { 11 | source = "hashicorp/helm" 12 | version = "= 2.5.1" 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /argo-cd-setup/setup.tf: -------------------------------------------------------------------------------- 1 | resource "helm_release" "argocd" { 2 | name = "argocd" 3 | repository = "https://argoproj.github.io/argo-helm" 4 | chart = "argo-cd" 5 | namespace = "argocd" 6 | create_namespace = true 7 | version = "3.35.4" 8 | values = [file("values/argocd.yaml")] 9 | } 10 | # helm install argocd -n argocd -f values/argocd.yaml 11 | -------------------------------------------------------------------------------- /argo-cd-setup/values/argocd.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | global: 3 | image: 4 | tag: "v2.6.6" 5 | 6 | dex: 7 | enabled: false 8 | 9 | server: 10 | extraArgs: 11 | - --insecure 12 | -------------------------------------------------------------------------------- /argocd-cicd-setup/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:latest 2 | LABEL name="Ravindra Singh" 3 | LABEL email="ravindrasinghh.me@gmail.com" 4 | ENV UBUNTU_HOME=/var/www/html/ 5 | RUN apt-get update -y 6 | ENV DEBIAN_FRONTEND noninteractive 7 | RUN apt-get -y install tzdata 8 | RUN apt-get install apache2 -y 9 | WORKDIR UBUNTU_HOME 10 | COPY argocd-cicd-setup/script/index.html ${UBUNTU_HOME} 11 | EXPOSE 80 12 | CMD ["apachectl" , "-D","FOREGROUND"] 13 | -------------------------------------------------------------------------------- /argocd-cicd-setup/application.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: argoproj.io/v1alpha1 3 | kind: Application 4 | metadata: 5 | name: my-application 6 | namespace: argocd 7 | # Finalizer that ensures that project is not deleted until it is not referenced by any application 8 | finalizers: 9 | - resources-finalizer.argocd.argoproj.io 10 | spec: 11 | project: my-app-project 12 | source: 13 | repoURL: 14 | targetRevision: HEAD 15 | path: environments/dev/my-app 16 | destination: 17 | server: https://kubernetes.default.svc 18 | namespace: my-app 19 | syncPolicy: 20 | automated: 21 | prune: true 22 | selfHeal: true 23 | allowEmpty: false 24 | 25 | syncOptions: 26 | - Validate=true 27 | - CreateNamespace=true 28 | - PrunePropagationPolicy=foreground 29 | - PruneLast=true 30 | -------------------------------------------------------------------------------- /argocd-cicd-setup/dev/deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: my-custom-container 6 | namespace: my-app 7 | spec: 8 | replicas: 1 9 | selector: 10 | matchLabels: 11 | app: nginx 12 | template: 13 | metadata: 14 | labels: 15 | app: nginx 16 | spec: 17 | containers: 18 | - name: my-container 19 | imagePullPolicy: Always 20 | image: ravindrasingh6969/my-app:latest 21 | ports: 22 | - containerPort: 80 23 | -------------------------------------------------------------------------------- /argocd-cicd-setup/dev/namespace.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Namespace 4 | metadata: 5 | name: my-app 6 | -------------------------------------------------------------------------------- /argocd-cicd-setup/project.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: argoproj.io/v1alpha1 2 | kind: AppProject 3 | metadata: 4 | name: my-app-project 5 | namespace: argocd 6 | # Finalizer that ensures that project is not deleted until it is not referenced by any application 7 | finalizers: 8 | - resources-finalizer.argocd.argoproj.io 9 | spec: 10 | syncPolicy: 11 | automated: 12 | prune: true 13 | selfHeal: true 14 | # Project description 15 | description: Learning CICD 16 | # Allow manifests to deploy from any Git repos 17 | sourceRepos: 18 | - '*' 19 | destinations: 20 | - namespace: my-app 21 | server: https://kubernetes.default.svc 22 | # Deny all cluster-scoped resources from being created, except for Namespace 23 | clusterResourceWhitelist: 24 | - group: '' 25 | kind: Namespace 26 | 27 | # is a feature that allows you to automatically delete Kubernetes resources that are no longer managed by any application in the ArgoCD cluster. 28 | orphanedResources: 29 | warn: false 30 | -------------------------------------------------------------------------------- /argocd-cicd-setup/script/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Style Property 6 | 7 | 8 | 9 |

Welcome to the Automation World!

10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /argocd-cicd-setup/ssh-secret.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Secret 4 | metadata: 5 | name: github-ssh-secret 6 | namespace: argocd 7 | labels: 8 | argocd.argoproj.io/secret-type: repository 9 | stringData: 10 | url: git@github.com:ravindrasinghh/argocd-setup.git 11 | sshPrivateKey: | 12 | -----BEGIN OPENSSH PRIVATE KEY----- 13 | b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW 14 | QyNTUxOQAAACD4VvJSOgw0f1q3ciDnuo1vLSENQp2+Pbi119YN01MymQAAAKD8mE3u/JhN 15 | 7gAAAAtzc2gtZWQyNTUxOQAAACD4VvJSOgw0f1q3ciDnuo1vLSENQp2+Pbi119YN01MymQ 16 | AAAEATgwm3oJL8RAAni1KsHL/QAkc6HrQydJl+XCKNTyOG7/hW8lI6DDR/WrdyIOe6jW** 17 | ***************************** 18 | -----END OPENSSH PRIVATE KEY----- 19 | insecure: "false" 20 | enableLfs: "true" 21 | 22 | 23 | # command to generate key 24 | # ssh-keygen -t ed25519 -f ~/.ssh/argocd 25 | 26 | -------------------------------------------------------------------------------- /docs/cicd2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ravindrasinghh/argocd-setup/92e7b45c19f4db0d46674e22b64214f6fedeca12/docs/cicd2.png -------------------------------------------------------------------------------- /docs/test.png: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /eks-setup/READEME.MD: -------------------------------------------------------------------------------- 1 | #Create VPC and EKS Cluster in AWS Account 2 | -------------------------------------------------------------------------------- /eks-setup/eks.tf: -------------------------------------------------------------------------------- 1 | resource "aws_iam_role" "demo" { 2 | name = "eks-cluster-demo" 3 | 4 | assume_role_policy = <