{"id":15419479,"url":"https://github.com/jonathanbeber/ambassador-demo","last_synced_at":"2025-03-28T03:44:50.763Z","repository":{"id":101108229,"uuid":"189218167","full_name":"jonathanbeber/ambassador-demo","owner":"jonathanbeber","description":"Kubernetes resources used to present an Ambassador demo during the DevOps meetup Berlin @ Onefootball","archived":false,"fork":false,"pushed_at":"2019-05-29T13:26:03.000Z","size":9,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-02T05:14:00.769Z","etag":null,"topics":["ambassador","api-gateway","demo","kubernetes"],"latest_commit_sha":null,"homepage":"https://getambassador.io/","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonathanbeber.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}},"created_at":"2019-05-29T12:10:20.000Z","updated_at":"2020-06-01T13:11:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"d7f4bf6a-1e1b-4571-a54f-550e64025440","html_url":"https://github.com/jonathanbeber/ambassador-demo","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"038dcd18d57e85e89865da870b4e9c8e66d7b064"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanbeber%2Fambassador-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanbeber%2Fambassador-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanbeber%2Fambassador-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanbeber%2Fambassador-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonathanbeber","download_url":"https://codeload.github.com/jonathanbeber/ambassador-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245966929,"owners_count":20701759,"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":["ambassador","api-gateway","demo","kubernetes"],"created_at":"2024-10-01T17:25:11.981Z","updated_at":"2025-03-28T03:44:50.676Z","avatar_url":"https://github.com/jonathanbeber.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Setup\n\nThis demo expects a running [kubernetes](https://kubernetes.io) environment with [helm](https://helm.sh) installed. To setup it fast and easily (non-production), the following commands can be used: \n\n```\nminikube start --kubernetes-version=v1.14.2 -p ambassador\nkubectl apply -f 01_rbac_helm.yaml\nhelm init\n```\nIn this example, we're using [minikube](https://github.com/kubernetes/minikube). You can check kubernetes [official docs](https://kubernetes.io/docs/tasks/tools/install-minikube/), for more details on how to install it.\n\n# Ambassador installation\n\nThe following steps install [Ambassador](https://www.getambassador.io/) using the [official helm charts](https://github.com/helm/charts/tree/master/stable/ambassador):\n\n```\nkubectl create namespace ambassador\nhelm upgrade --install --namespace=ambassador --values=02_ambassador_values.yaml ambassador stable/ambassador\n```\n\nTo check ambassador deployment status, you can check for the resources status:\n\n```\nkubectl get all -n ambassador\n```\n\nThe following command will map ambassador admin ui for your computer:\n```\nkubectl port-forward -n ambassador svc/ambassador-admins 8877\n```\n\nThe interface is accessible now [here](http://localhost:8877/ambassador/v0/diag/) and it's used mainly for debugging purposes.\n\n# Simple Service v1\n\nWe're going to deploy a simple-service and its mappings for ambassador:\n\n```\nkubectl apply -f 03_deploy_v1.yaml\nkubectl apply -f 04_mapping_v1.yaml\n```\n\nAgain, in the [admin ui](http://localhost:8877/ambassador/v0/diag/) address is possible to see Ambassador created mapping resources.\n\nIn order to access the `simple-service` trough Ambassador it's necessary to map its service to our computer as well. The following command it's just necessary because this demo it's not running on a cloud environment. On a cloud environment we'd be accessing it trough a Cloud Load Balancer solution.\n\n```\nkubectl port-forward svc/ambassador -n ambassador 8000:80\n```\n\nTest the access to `simple-service` with a simple http request: `curl http://localhost:8000/simple-service/v1/`\n\n# Simple Service v2\n\nNow, we're going to create a new version of the same service and its mappings:\n\n```\nkubectl apply -f 05_deploy_v2.yaml\nkubectl apply -f 06_mapping_v2.yaml\n```\n\nAgain, in the [admin ui](http://localhost:8877/ambassador/v0/diag/) address is possible to see Ambassador created mapping resources.\nTest the access to `simple-service` `v2` with a simple http request: `curl http://localhost:8000/simple-service/v2/`\n\n# Simple Service Canary\n\nThis example, try to represent a simple and manually [Canary Release](https://martinfowler.com/bliki/CanaryRelease.html):\n\n```\nkubectl apply -f 07_mapping_weight.yaml\n```\n\nThe [admin ui](http://localhost:8877/ambassador/v0/diag/) will present to mappings with its defined weights. We can test it making multiple http requests to the mapped endpoint:\n```\nfor i in {1..20}; do curl http://localhost:8000/simple-service/; echo; done\n```\n\n## Change weights\n\nLet's edit the file [07_mapping_weight.yaml](./07_mapping_weight.yaml) changing the mapping weights. This action could be performed since the team is confident with the change, increasing the percentage of clients accessing it. After it, apply this changes running `kubectl apply -f 07_mapping_weight.yaml` again.\n\nThen check if the applied configs are reflected on the [admin ui](http://localhost:8877/ambassador/v0/diag/). Once again, it's possible to check the configuration running multiple requests to the service:\n\n```\nfor i in {1..20}; do curl http://localhost:8000/simple-service/; echo; done\n```\n\n# Headers\n\nAs a final example, it's possible to route traffic based on the request's headers. Apply the following mapping example:\n\n```\nkubectl apply -f 08_mapping_header.yaml\n```\n\nCheck if the mapping is on the [admin ui](http://localhost:8877/ambassador/v0/diag/) and modify your http request to include the header defined on [08_mapping_header.yaml](./08_mapping_header.yaml):\n\n```\nfor i in {1..20}; do curl -H \"am-i-a-test: true\" http://localhost:8000/simple-service/; echo; done\n```\n\n# Next steps\n\nRefer to the [Ambassador official documentation](https://www.getambassador.io/docs) for more features and details using Ambassador.\n\n# Cleaning up\n\n```\nminikube delete -p ambassador\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanbeber%2Fambassador-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonathanbeber%2Fambassador-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanbeber%2Fambassador-demo/lists"}