How to configure Google Kubernetes Engine (GKE) using ArgoCD?

How to configure Google Kubernetes Engine (GKE) using ArgoCD?

ArgoProj is a collection of tools for getting work done with Kubernetes. Argo Workflows - Container-native Workflow Engine. Argo CD - Declarative GitOps Continuous Delivery. Argo Events - Event-based Dependency Manager. Argo Rollouts - Progressive Delivery with support for Canary and Blue-Green deployment strategies. Reference: https://landscape.cncf.io/?selected=argo

Google Kubernetes Engine (GKE) is a managed, production-ready environment for running containerized applications on Kubernetes. Reference: https://cloud.google.com/kubernetes-engine

Prerequisite

Step

  1. Create Kubernetes configuration on the git repo. Reference: https://github.com/manikandank276/blog/tree/main/argoproject-101/config/namespace

     apiVersion: v1
     kind: Namespace
     metadata:
       name: namespace1
     ---
     apiVersion: v1
     kind: ResourceQuota
     metadata:
       name: quota1
       namespace: namespace1
     spec:
       hard:
         cpu: "20"
         memory: "7Mi"
         pods: "15"
         replicationcontrollers: "20"
         resourcequotas: "1"
         services: "5"
    
  2. Review the GKE cluster.

     kubectl get node
     kubectl get namespaces
     kubectl get pods --namespace <type namespace name>
    
  3. Login to ArgoCD.

  4. Click on the "+ NEW APP" button.

  5. Fill "GENERAL" form.

    • Application Name: gke-config (or type your preference)

    • Project Name: default

    • SYNC POLICY: Manual

  6. Fill "SOURCE" form.

    • Repository URL: https://github.com/manikandank276/blog (or type your preference)

    • select GIT dropdown

    • Revision: HEAD

    • Select Branches dropdown

    • Path: argoproject-101/config/namespace (or type your preference)

  7. Fill "DESTINATION" form.

  8. Click on the "CREATE" button.

  9. The new application creates successfully.

  10. Click on the "gke-config" name with "OutOfSync".

  11. The app shows details of Kubernetes configuration.

  12. Click on the "SYNC" button.

  13. Review the form and click on the "SYNCHRONIZE" button.

  14. The applicaiton changes to "Synced".

  15. Review the GKE cluster.

    kubectl get node
    kubectl get namespaces
    #New namespace/configuration listed
    
  16. Add or Modify configuration in the git repo.

  17. The change reflects in ArgoCD and shows as "OutOfSync". Click on the "SYNC" button to deploy changes in the GKE.

GKE configured successfully. The output looks like the one below.

kubectl get namespace
NAME              STATUS   AGE
argocd            Active   87m
default           Active   93m
kube-node-lease   Active   93m
kube-public       Active   93m
kube-system       Active   93m
namespace1        Active   5m42s
namespace2        Active   5m42s
namespace3        Active   5m42s
namespace4        Active   5m42s
namespace5        Active   5m42s