{"id":18402524,"url":"https://github.com/wingkwong/argocd-playground","last_synced_at":"2025-04-07T07:32:16.517Z","repository":{"id":95977530,"uuid":"251295016","full_name":"wingkwong/argocd-playground","owner":"wingkwong","description":"Demonstrating how to setup Argo CD on a k3s cluster using arkade and k3d","archived":false,"fork":false,"pushed_at":"2023-12-15T11:56:34.000Z","size":10,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-22T14:34:52.468Z","etag":null,"topics":["argocd","arkade","gitops","k3d"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wingkwong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"wingkwong","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2020-03-30T12:16:40.000Z","updated_at":"2023-04-15T15:21:32.000Z","dependencies_parsed_at":"2024-06-21T14:36:21.216Z","dependency_job_id":null,"html_url":"https://github.com/wingkwong/argocd-playground","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wingkwong%2Fargocd-playground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wingkwong%2Fargocd-playground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wingkwong%2Fargocd-playground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wingkwong%2Fargocd-playground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wingkwong","download_url":"https://codeload.github.com/wingkwong/argocd-playground/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247612365,"owners_count":20966726,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["argocd","arkade","gitops","k3d"],"created_at":"2024-11-06T02:42:43.100Z","updated_at":"2025-04-07T07:32:16.253Z","avatar_url":"https://github.com/wingkwong.png","language":"Go","funding_links":["https://github.com/sponsors/wingkwong"],"categories":[],"sub_categories":[],"readme":"# argocd-playground\n\nDemonstrating how to setup Argo CD on a k3s cluster using arkade and k3d. \n\n\u003e This is just a learning playground\n\n# Prerequisites\nYou need to install Docker on your machine and you need to register for a Docker Hub account as your Docker images will be stored there\n\n# Install k3d\nk3d is a little helper to run k3s in docker, where k3s is the lightweight Kubernetes distribution by Rancher. It actually removes millions of lines of code from k8s. If you just need a learning playground, k3s is definitely your choice.\n\nCheck out [k3d Github Page](https://github.com/rancher/k3d#get) to see the installation guide.\n\n\u003e When creating a cluster, ``k3d`` utilises ``kubectl`` and ``kubectl`` is not part of ``k3d``. If you don't have ``kubectl``, please install and set up [here](https://kubernetes.io/docs/tasks/tools/install-kubectl/). \n\nOnce you've installed ``k3d`` and ``kubectl``, run\n```\nk3d create -n argocd-playground\n```\n\nWe need to make ``kubectl`` to use the kubeconfig for that cluster.\n```\nexport KUBECONFIG=\"$(k3d get-kubeconfig --name='argocd-playground')\"\n```\n\n# Install arkade \nMoving on to [arkade](https://github.com/alexellis/arkade), it provides a simple Golang CLI with strongly-typed flags to install charts and apps to your cluster in one command. Originally, the codebase is derived from [k3sup](https://github.com/alexellis/k3sup) which I've contributed last month. \n\n```\ncurl -sLS https://dl.get-arkade.dev | sudo sh\n```\n\nOnce you've installed it, you should see the following\n```\nNew version of arkade installed to /usr/local/bin\n            _             _\n  __ _ _ __| | ____ _  __| | ___\n / _` | '__| |/ / _` |/ _` |/ _ \\\n| (_| | |  |   \u003c (_| | (_| |  __/\n \\__,_|_|  |_|\\_\\__,_|\\__,_|\\___|\n\nGet Kubernetes apps the easy way\n\nVersion: 0.2.2\nGit Commit: 9063b6eb16deae5978805f71b0e749828c815490\n```\n\nInstall Argo CD via arkade. You can use an alias ``ark`` or ``arkade``. \n```\nark install argocd\n```\n\nYou should see the following info\n```\nUsing kubeconfig: /Users/wingkwong/.config/k3d/argocd-playground/kubeconfig.yaml\nNode architecture: \"amd64\"\n=======================================================================\n= ArgoCD has been installed                                           =\n=======================================================================\n\n\n# Get the ArgoCD CLI\n\nbrew tap argoproj/tap\nbrew install argoproj/tap/argocd\n\n# Or download via https://github.com/argoproj/argo-cd/releases/latest\n\n# Username is \"admin\", get the password\n\nkubectl get pods -n argocd -l app.kubernetes.io/name=argocd-server -o name | cut -d'/' -f 2\n\n# Port-forward\n\nkubectl port-forward svc/argocd-server -n argocd 8081:443 \u0026\n\nhttp://localhost:8081\n\n# Get started with ArgoCD at\n# https://argoproj.github.io/argo-cd/#quick-start\n\nThanks for using arkade!\n```\n\nFollow the step to enable port forwarding \n```\nkubectl port-forward svc/argocd-server -n argocd 8081:443 \u0026\n```\n\n```\nForwarding from [::1]:8081 -\u003e 8080\n```\n\nOpen your browser and browse ``http://localhost:8080/``. You should see the Argo CD UI.\n![image](https://user-images.githubusercontent.com/35857179/77913084-3bc3cc00-72c6-11ea-8175-572f46bfa626.png)\n\nAs stated in the console info upon the completion of installation, the username is ``admin`` and you can get hte password by running \n\n```\nkubectl get pods -n argocd -l app.kubernetes.io/name=argocd-server -o name | cut -d'/' -f 2\n```\n\n\u003e If you want to check out the info, you can run ``ark info argocd``.\n\nAfter logging in, you should see the application page.\n![image](https://user-images.githubusercontent.com/35857179/77913544-053a8100-72c7-11ea-8047-7c2b5dc3b493.png)\n\nSet your application name. Use the project ``default`` and choose the sync policy to ``Manual``.\n![image](https://user-images.githubusercontent.com/35857179/77914661-d6250f00-72c8-11ea-9554-38afc52f7fdf.png)\n\nConnect your repository to Argo CD. Select the revision and the path where your manifests files are located.\n![image](https://user-images.githubusercontent.com/35857179/77918790-f35cdc00-72ce-11ea-93dc-488f50f947e1.png)\n\nSet the cluster to ``https://kubernetes.default.svc`` with ``default`` namespace.\n![image](https://user-images.githubusercontent.com/35857179/77914835-0ec4e880-72c9-11ea-8833-18e60096172b.png)\n\nClick ``Create``. Then you should see there is an application on the portal.\n![image](https://user-images.githubusercontent.com/35857179/77915215-a6c2d200-72c9-11ea-8683-06c5a8eb7c54.png)\n\nYou can also switch it to the list view\n![image](https://user-images.githubusercontent.com/35857179/77915232-af1b0d00-72c9-11ea-89b0-1cbffc3b923c.png)\n\nor summary view\n![image](https://user-images.githubusercontent.com/35857179/77915240-b6421b00-72c9-11ea-8be3-c9e500d35e90.png)\n\nHere is my application\n```go\npackage main\n\nimport (\n\t\"io\"\n\t\"log\"\n\t\"net/http\"\n)\n\nfunc main() {\n\n\thttp.HandleFunc(\"/\", Handler)\n\n\tif err := http.ListenAndServe(\":8888\", nil); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n\nfunc Handler(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tio.WriteString(w, `{\"status\":\"ok\"}`)\n}\n```\n\nLet's add ``deployment.yaml``\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: argocd-playground\nspec:\n  replicas: 1\n  revisionHistoryLimit: 3\n  selector:\n    matchLabels:\n      app: argocd-playground\n  template:\n    metadata:\n      labels:\n        app: argocd-playground\n    spec:\n      containers:\n      - image: wingkwong/argocd-playground:v1\n        name: argocd-playground\n        ports:\n        - containerPort: 8888\n```\n\nand ``service.yaml``\n\n```yml\napiVersion: v1\nkind: Service\nmetadata:\n  name: argocd-playground\nspec:\n  ports:\n  - port: 8888\n    targetPort: 8888\n  selector:\n    app: argocd-playground\n```\n\nOnce you've pushed your commit, Argo CD detects changes under ``manifests``. It updates the status to ``OutOfSync``.\n![image](https://user-images.githubusercontent.com/35857179/77918199-20f55580-72ce-11ea-8784-d365b8af6b31.png)\n\nLet's sync. \n![image](https://user-images.githubusercontent.com/35857179/77918456-7e89a200-72ce-11ea-88dd-625b97c64e3c.png)\n\nEnable port forwarding \n```\nkubectl port-forward svc/argocd-playground 8888:8888\n```\n\nVerify v1 in the browser\n```\nhttp://localhost:8888/\n```\n\nYou should see\n```\n{\"status\":\"ok\"}\n```\n\nUpdate the application\n\n![image](https://user-images.githubusercontent.com/35857179/78024972-d20df580-738b-11ea-9c5f-245c4277c2ff.png)\n\nBuild and push the docker image to docker hub. Then update the image tag to v2 in ``deployment.yaml``.\n\n```yaml\n- image: wingkwong/argocd-playground:v2\n```\n\nGo back to Argo CD UI, the status becomes ``OutofSync``.\n\n![image](https://user-images.githubusercontent.com/35857179/78025927-688ee680-738d-11ea-81d9-4d6d5c05c34c.png)\n\nClick ``SYNC``\n\nA new pod is being created, while the original one is still here.\n\n![image](https://user-images.githubusercontent.com/35857179/78025985-83f9f180-738d-11ea-9791-556a3d50851f.png)\n\nOnce it is ready, the original one will be deleted.\n![image](https://user-images.githubusercontent.com/35857179/78026005-89efd280-738d-11ea-9804-abbd78b56358.png)\n\nYou should see the below error\n```\nE0331 20:24:00.727018   61938 portforward.go:400] an error occurred forwarding 8888 -\u003e 8888: error forwarding port 8888 to pod 0f8b6902adcdbfdcde17a17bc1d182db8c4c849ba50ef369d90969e1349797b5, uid : failed to find sandbox \"0f8b6902adcdbfdcde17a17bc1d182db8c4c849ba50ef369d90969e1349797b5\" in store: does not exist\n```\n\nWe should stop port forwarding before redeploying a different version. Let's kill it and do it again. \n\n```\nkubectl port-forward svc/argocd-playground 8888:8888\n```\n\nGo to \n```\nhttp://localhost:8888/\n```\n\nNow you can see the new changes\n```\n{\"status\":\"ok\", \"message\": \"hello-world\"}\n```\n\n# Clean up\n```\nk3d delete -n argocd-playground\n```\n\n# Compare with FluxCD\nArgo CD allows users to sync in an application level instead of a repository level by setting the Path. It supports different templating such as kustomize, helm, ksonnet, jsonnet, etc. With an UI portal, users can simply manage the application there. However, it cannot monitor a docker repository and deploy from the repository. The docker image needs to be manually updated for each updates.  \n\n# Useful links\n- [Argo CD](https://argoproj.github.io/argo-cd/)\n- [arkade](https://github.com/alexellis/arkade#get-arkade)\n- [k3d](https://github.com/rancher/k3d)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwingkwong%2Fargocd-playground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwingkwong%2Fargocd-playground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwingkwong%2Fargocd-playground/lists"}