{"id":20113320,"url":"https://github.com/cloudacademy/gitops-demo","last_synced_at":"2025-07-19T19:40:40.525Z","repository":{"id":46723115,"uuid":"234422409","full_name":"cloudacademy/gitops-demo","owner":"cloudacademy","description":"gitops-demo","archived":false,"fork":false,"pushed_at":"2021-09-28T12:24:51.000Z","size":65,"stargazers_count":14,"open_issues_count":0,"forks_count":114,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T12:11:39.901Z","etag":null,"topics":["cloudacademy","devops","docker","flask","gitops","k8s","kubernetes","nginx"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudacademy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-16T22:15:26.000Z","updated_at":"2022-07-04T20:08:17.000Z","dependencies_parsed_at":"2022-08-30T07:11:31.568Z","dependency_job_id":null,"html_url":"https://github.com/cloudacademy/gitops-demo","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudacademy%2Fgitops-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudacademy%2Fgitops-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudacademy%2Fgitops-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudacademy%2Fgitops-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudacademy","download_url":"https://codeload.github.com/cloudacademy/gitops-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252683361,"owners_count":21788022,"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":["cloudacademy","devops","docker","flask","gitops","k8s","kubernetes","nginx"],"created_at":"2024-11-13T18:24:00.972Z","updated_at":"2025-05-06T12:30:28.469Z","avatar_url":"https://github.com/cloudacademy.png","language":"Python","readme":"# GitOps Demo\nThis is used by the [Introduction to GitOps](https://cloudacademy.com/course/introduction-gitops/) course presented by CloudAcademy.\n\n![GitOps Demo](./docs/GitOps1.png)\n\n**Updates**\n- Fri 4 Dec 2020: updated install instructions to work with latest versions of tools and Flux chart\n\n## Fork Repo\nIf you intend to watch the course and repeat the same instructions in your own environment, then you *must* fork this repository into your own GitHub account. The reason for this, is that you need to be the *owner* of the repo to be able to upload and configure a new *Deploy Key* within the *Settings* area of the repo. The new *Deploy Key* will contain the Flux operators SSH public key. \n\n## GitOps - Flux Install Instructions \n\n### TOOLS (versions)\n\n- helm (v3.4.0)\n- kubectl (1.19.3)\n- minikube (1.15.1)\n- k8s (v1.19.4)\n\n**NOTE**: Helm3 is easier and more secure - doesn't require the Tiller component/service to be installed in the K8s cluster (Helm2 did)\n\n### Step 1.\n\nStart a K8s cluster locally - only do this if you need a cluster\n\n```\nminikube start --memory=4g --kubernetes-version=v1.19.4\n```\n\n### Step 2.\n\nUse browser and open https://artifacthub.io/\n\nSearch for \"Flux\" - click on the \"flux\" chart result - here you can review the install instructions, which follow.\n\nRun the following commands to install the \"flux\" chart\n\n```\nhelm repo add flux https://charts.fluxcd.io\nhelm repo update\n```\n\n```\nkubectl create ns flux\nkubectl create ns cloudacademy\n```\n\n```\nhelm search repo flux\n```\n\n**NOTE**: replace the git.url parameter with YOUR FORKed copy - so that you can later set the SSH public key as a DeployKey within your own Github FORKed repo\n\n```\nhelm install flux --set git.url=git@github.com:cloudacademy/gitops-demo --namespace flux flux/flux --version 1.6.0\n```\n\n**NOTE**: if needed you can perform a \"helm upgrade\" to change the Flux deployed chart's git.url like this:\n\n```\nhelm upgrade -i flux fluxcd/flux --set git.url=git@github.com:myaccount/gitops-demo --namespace flux\n```\n\nExamine the rollout of Flux...\n\n```\nkubectl rollout status deployment flux -n flux\n```\n\n```\nkubectl get pods -n flux\n```\n\n```\nkubectl -n flux logs deployment/flux --follow\n```\n\nCTRL-C to exit previous command\n\n### Step 3.\n\nRetrieve SSH public key and then add as a DeployKey within your own Github FORKed repo:\n\n```\nkubectl -n flux logs deployment/flux | grep identity.pub | cut -d '\"' -f2\n```\n\n### Step 4.\n\nCheck to see that the gitops-demo resources have been automatically deployed by Flux into the cloudacademy namespace within the K8s cluster\n\n```\nkubectl get pods -n cloudacademy\nkubectl describe pod -n cloudacademy\n```\n\n```\nkubectl get pods -n cloudacademy --watch\n```\n\nCTRL-C to exit previous command\n\n```\nkubectl rollout status deployment frontend -n cloudacademy\n```\n\n\n### Step 5.\n\nThe following steps demonstrate how Flux will automatically rollout a new K8s deployment when updates are made, and pushed back into the Git repo.\n\n**Note** The DockerHub repo docker.io/cloudacademydevops is owned by CloudAcademy - you will not be able to push (write) into it. Instead, perform the following:\n\n5.1. Create your own DockerHub account (https://hub.docker.com/) - say for now you create it with a username of `xyzdevops`, resulting in a new DockerHub repo docker.io/xyzdevops\n\n5.2. Git clone this FORKed Github repo locally, and then navigate into the FlaskApp dir `./gitops-demo/tree/master/flaskapp`\n\n5.3. Perform a local docker build and tag it to be stored in your new DockerHub repo `docker.io/xyzdevops` - making sure that the tag name continues to use the `flaskapp:develop-v1.8.0` naming format - since this is used by Flux (particularly the version numbering format)\n\n```\ndocker build -t  gregdevops/flaskapp:develop-v1.8.0 .\n```\n\n5.4. Push the resulting Docker image up into your new DockerHub repo `docker.io/xyzdevops`\n\n```\ndocker push xyzdevops/flaskapp:develop-v1.8.0\n```\n\n5.5 Back within your FORKed Github repo, update (line 35) the K8s deployment manifest `./k8s/deployment.yaml` to use your newly hosted docker image: `docker.io/xyzdevops/flaskapp:develop-v1.8.0`\n\n5.6. Commit and push the updates (K8s deployment manifest) back up into your FORKed repo\n\n5.7. Watch the magic happen!!\n\n:metal:\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudacademy%2Fgitops-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudacademy%2Fgitops-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudacademy%2Fgitops-demo/lists"}