https://github.com/nmaxime/apisix-example
This repo contains an "hello world" application in a Kind kubernetes cluster, exposed with Apisix.
https://github.com/nmaxime/apisix-example
apisix helm kind kubernetes
Last synced: 3 months ago
JSON representation
This repo contains an "hello world" application in a Kind kubernetes cluster, exposed with Apisix.
- Host: GitHub
- URL: https://github.com/nmaxime/apisix-example
- Owner: Nmaxime
- License: mit
- Created: 2022-10-18T16:09:47.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-18T16:12:27.000Z (almost 3 years ago)
- Last Synced: 2025-07-09T01:52:48.349Z (3 months ago)
- Topics: apisix, helm, kind, kubernetes
- Language: Smarty
- Homepage: https://apisix-example.vercel.app
- Size: 91.8 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Instructions
- Install Kind (Kubernetes in Docker)
- Create a kind cluster
- Pull the kind image: `docker pull kindest/node:v1.25.2@sha256:9be91e9e9cdf116809841fc77ebdb8845443c4c72fe5218f3ae9eb57fdb4bace`
- Then run: `kind create cluster --config ./kind-cluster-config.yaml`
- Build the docker image at the root folder of the project with `docker build . -t learnk8s/challenge:0.1.0`
- Add the build image to kind: `kind load docker-image learnk8s/challenge:0.1.0`- Run: `helm repo add bitnami https://charts.bitnami.com/bitnami`
- Run: `helm repo add apisix https://charts.apiseven.com`### Apisix Ingress
In `charts/apisix` folder, run:
- `helm dependency update`
- `helm upgrade --install -n ingress-apisix --create-namespace ingress-apisix .`Verify your installation created 5 services: `kubectl get service --namespace ingress-apisix`
### Hello application
In `charts/hello` folder, run:
- `helm upgrade --install -n hello --create-namespace hello .`Verify your hello pod is running: `kubectl get pod --namespace hello`.
You should see a status "Running" in the output.#
## Verify all is working
### Check the hello route configuration
Note that the API KEY is the default one, it is not intented for production usage.
`kubectl -n ingress-apisix exec -it $(kubectl get pods -n ingress-apisix -l app.kubernetes.io/name=apisix -o name) -- curl "http://127.0.0.1:9180/apisix/admin/routes" -H "X-API-KEY: edd1c9f034335f136f87ad84b625c8f1"`
### Check the hello route response
Run:
`kubectl exec -it $(kubectl get pods -n ingress-apisix -l app.kubernetes.io/name=apisix -o name) -- curl http://127.0.0.1:9080/ -H 'Host: localhost'`
Expected output: `Hello Nmaxime!`
### Call the ingress from the outside
Get the kind-worker node IP:
`WORKER_IP=$(kubectl get no kind-worker -o jsonpath='{.status.addresses[0].address}')`
Get the node port of the API gateway service:
`GATEWAY_PORT=$(kubectl get svc ingress-apisix-gateway -o=jsonpath='{.spec.ports[0].nodePort}')`
Then verify you get the `Hello Nmaxime!` response from the hello service:
`curl $WORKER_IP:$GATEWAY_PORT/ -H "Host: localhost"`