Kubernetes, Kustomize, Helm and Argocd - hqzhang/cloudtestbed GitHub Wiki

Kubernetes Data Model Types

  1)Kubernetes:  Kind List(items: deployment/service/ingress)
  kubectl apply -f Kind_List(deployment/service/ingress)

  2)Templates:  kind: Template(objects: deployment/service/ingress, parameters:*)
  kubectl process -f Kind_Template. ==> KindList

  3)Kustomize:   Kind: Kustomization( resources: - deployment.yaml 
  kuberctl apply -k Kustomization.yaml

  4)Argocd:      kind: Application(source: repo(kube,kust,helm, destination: https://kubernetes.default.svc)
  kubectl apply -n argocd -f ./argo/arego-cd/app.yaml

  5)Helm:       kind application chart.yaml
  helm install myfirst  ./mychart

Argocd Installation

1. Installation
1) install argued
  kubectl create namespace argocd;
  kubectl delete namespace customize-nginx
  kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml;
  kubectl apply -f https://github.com/bitnami-labs/sealed-secrets/releases/download/v0.15.0/controller.yaml
  kubectl port-forward svc/argocd-server -n argocd 8080:443

2) create and apply sealed secret
  kubectl -n default create secret generic mysecret --dry-run=client --from-literal foo=bar --output json |\
          kubeseal > sealsect.json
  kubectl apply -f sealsect.json

3) create and deploy apps
   kubectl apply -n argocd -f ./argo/argo-cd/app.yaml
   kubectl delete -n argocd -f ./argo/argo-cd/app.yaml

3) port expose
 kubectl port-forward svc/argocd-server -n argocd 8080:443.                 //access localhost:8080  good one
 kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "NodePort"}}' //access localhost:30845
 Or using imgress


Argocd Usage

0) login argocd
 i)password for argo cd  id=admin
  kubectl get pods -n argocd -l app.kubernetes.io/name=argocd-server -o name | cut -d'/' -f 2
  argocd-server-547d9bb879-kbnvl

 ii)argocd login localhost:8080  --username admin --password argocd-server-69678b4f65-ktktq
1)create an template
  argocd app create guestbook --repo https://github.com/argoproj/argocd-example-apps.git --path \
        guestbook --dest-server https://kubernetes.default.svc --dest-namespace default

2)deploy app
  argocd app get guestbook
  argocd app sync guestbook

3)undeploy app
  argocd app delete guestbook
  kubectl delete app APPNAME

4) deploy by Application yaml
   kubectl apply -n argocd -f ./argo/argo-cd/app.yaml