โ ~ kind create cluster Creating cluster "kind" ... โ Ensuring node image (kindest/node:v1.30.0) ๐ผ โ Preparing nodes ๐ฆ โ Writing configuration ๐ โ Starting control-plane ๐น๏ธ โ Installing CNI ๐ โ Installing StorageClass ๐พ Set kubectl context to "kind-kind" You can now use your cluster with:
kubectl cluster-info --context kind-kind
Not sure what to do next? ๐ Check out https://kind.sigs.k8s.io/docs/user/quick-start/ โ ~ kubectl cluster-info --context kind-kind Kubernetes control plane is running at https://127.0.0.1:55880 CoreDNS is running at https://127.0.0.1:55880/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
2. deploy ArgoCD
in this section will deploy the argocd by manifests and connect to the argocd server.
to install argocd by manifests
1 2 3 4 5 6
โ ~ kubectl create namespace argocd kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml namespace/argocd created customresourcedefinition.apiextensions.k8s.io/applications.argoproj.io created customresourcedefinition.apiextensions.k8s.io/applicationsets.argoproj.io created customresourcedefinition.apiextensions.k8s.io/appprojects.argoproj.io created
change the argocd server to insecure mode
to change the argoCD with insecure mode by kubectl -n argocd edit deploy argocd-server and update the following lines
1 2
-name:ARGOCD_SERVER_INSECURE value:"true"
check the argocd-server log to see if it is running. the keyworkd is tls: false
1 2 3 4 5 6 7 8
โ ~ kubectl -n argocd logs argocd-server-7b4b4cdff5-xb6b5 time="2024-05-30T06:58:13Z" level=info msg="ArgoCD API Server is starting" built="2024-05-23T13:32:13Z" commit=25f7504ecc198e7d7fdc055fdb83ae50eee5edd0 namespace=argocd port=8080 version=v2.11.2+25f7504 time="2024-05-30T06:58:13Z" level=info msg="Starting configmap/secret informers" time="2024-05-30T06:58:13Z" level=info msg="Configmap/secret informer synced" time="2024-05-30T06:58:13Z" level=info msg="invalidated cache for resource in namespace: argocd with the name: argocd-notifications-secret" time="2024-05-30T06:58:13Z" level=info msg="invalidated cache for resource in namespace: argocd with the name: argocd-notifications-cm" time="2024-05-30T06:58:13Z" level=info msg="argocd v2.11.2+25f7504 serving on port 8080 (url: , tls: false, namespace: argocd, sso: false)" time="2024-05-30T06:58:13Z" level=info msg="Enabled application namespace patterns: argocd"
expose argocd k8s service
actually, the argocd server is running in the local k8s cluster, and we can expose the service to the localhost by kubectl port-forward svc/argocd-server -n argocd 8080:80
and if you have a cloud provider, you can change the service type to LoadBalancer by kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
โ argocd-example-apps git:(master) โ argocd login localhost:8080 WARNING: server is not configured with TLS. Proceed (y/n)? y Username: admin Password: 'admin:login' logged in successfully Context 'localhost:8080' updated
4. deploy example apps
install a example app guestbook which fork from argocd-example-apps.
GROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE Service default guestbook-ui OutOfSync Missing apps Deployment default guestbook-ui OutOfSync Missing
GROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE Service default guestbook-ui Synced Healthy service/guestbook-ui created apps Deployment default guestbook-ui Synced Progressing deployment.apps/guestbook-ui created
5. Github webhook
create a Github webhook
my repo is Sn0rt/argocd-example-apps , and it not reachable from the internet, so I use gh to forward the webhook events to my localhost.
โ argocd-example-apps git:(master) โ git remote show origin
* remote origin Fetch URL: git@github.com:Sn0rt/argocd-example-apps.git Push URL: git@github.com:Sn0rt/argocd-example-apps.git HEAD branch: master Remote branch: master tracked Local branch configured for 'git pull': master merges with remote master Local ref configured for 'git push': master pushes to master (local out of date) โ argocd-example-apps git:(master) โ git diff diff --git a/guestbook/guestbook-ui-deployment.yaml b/guestbook/guestbook-ui-deployment.yaml index 8a0975e..956af43 100644 --- a/guestbook/guestbook-ui-deployment.yaml +++ b/guestbook/guestbook-ui-deployment.yaml @@ -3,7 +3,7 @@ kind: Deployment metadata: name: guestbook-ui spec: - replicas: 1 + replicas: 2 revisionHistoryLimit: 3 selector: matchLabels: โ argocd-example-apps git:(master) โ git add guestbook/guestbook-ui-deployment.yaml โ argocd-example-apps git:(master) โ git ci -s -m "update: scale out 2 instances" [master 1c2ed1b] update: scale out 2 instances 1 file changed, 1 insertion(+), 1 deletion(-) โ argocd-example-apps git:(master) โ git push origin -f Enumerating objects: 7, done. Counting objects: 100% (7/7), done. Delta compression using up to 10 threads Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 418 bytes | 418.00 KiB/s, done. Total 4 (delta 2), reused 0 (delta 0), pack-reused 0 remote: Resolving deltas: 100% (2/2), completed with 2 local objects. To github.com:Sn0rt/argocd-example-apps.git d7927a2..1c2ed1b master -> master
inspect the argcd-server log
so.. the conclusion is that the webhook event is received by the argocd-server, and the application is refreshed. and just tell me the application status is OutOfSync and Healthy
GROUP KIND NAMESPACE NAME STATUS HEALTH HOOK MESSAGE Service default guestbook-ui Synced Healthy service/guestbook-ui created apps Deployment default guestbook-ui OutOfSync Healthy deployment.apps/guestbook-ui created
6. Blue-Green Deployment
in this section, we will deploy a blue-green deployment by argocd and argocd-rollouts.