asdf plugin add kubectl
asdf plugin add helm
asdf installBecause in this tutorial we are going to use ArgoCD it's recommended to fork the original project to your personal GitHub account.
Once the fork has completed, edit the following files replacing the repoURL variable to your GitHub profile.
git clone [email protected]:<username>/kind-kong.git
# Edit files
# - config/argocd-foo-bar-app.yaml
# - config/argocd-httpbin-app.yaml
# - resources/argocd-app-of-apps.yaml
git add config
git commit -m "Update repoURL to my local GitHub"
git push origin mainkind create cluster --name kong --config=resources/kind.yaml
kind get kubeconfig --name kong > ~/.kube/kind-kong-config# Setup kubeconfig
export KUBECONFIG=~/.kube/kind-kong-config
# Testing configuration
kubectl get nodesTo complete layer2 configuration, we need to provide metallb a range of IP addresses it controls. We want this range to be on the docker kind network.
docker network inspect -f '{{.IPAM.Config}}' kindEdit the file argocd-metallb.yaml adding the ip range you want.
/etc/hosts
192.168.32.2 httpbin.local
192.168.32.2 grafana.local
192.168.32.2 prometheus.local
192.168.32.2 argocd.localhelm repo add argo https://argoproj.github.io/argo-helm
helm repo update
helm install argo-cd argo/argo-cd --create-namespace --namespace argocd --version 4.5.7 --values resources/argocd-values.yaml
# Check pods
kubectl get pod -n argocd --watchThe initial password for the admin account is auto-generated and stored as clear text in the field password in a secret named argocd-initial-admin-secret in your Argo CD installation namespace.
You can simply retrieve this password using kubectl:
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echoOn a secondary terminal
kubectl port-forward service/argo-cd-argocd-server -n argocd 8080:443Go to the argocd webpage https://localhost:8080 and sync the Argo Application app-of-apps.
kubectl -n argocd apply -f resources/argocd-app-of-apps.yamlkubectl -n argocd patch deployment argo-cd-argocd-server --type json \
-p='[ { "op": "replace", "path":"/spec/template/spec/containers/0/command","value": ["argocd-server","--staticassets","/shared/app","--repo-server","argo-cd-argocd-repo-server:8081","--dex-server","http://argo-cd-argocd-dex-server:5556","--logformat","text","--loglevel","info","--redis","argo-cd-argocd-redis:6379","--insecure"] }]'This command could take some time to reload the Pod.
- argocd
- httpbin
- prometheus
- grafana
- Username:
admin - Password:
kong
- Username:
kubectl apply -n httpbin -f kong-plugins/rate-limiting.yaml
kubectl apply -f kong-plugins/prometheus.yaml
The custom plugin is located at myheader folder.
Next, we are going to create a ConfigMap or Secret based on the plugin code.
Please ensure that this is created in the same namespace as the one in which Kong is installed.
# using ConfigMap; replace `myheader` with the name of your plugin
kubectl create configmap kong-plugin-myheader --from-file=myheader -n kong
# OR using Secret
kubectl create secret generic -n kong kong-plugin-myheader --from-file=myheaderEdit/uncomment the Kong deployment configuration to install the custom plugin under config/argocd-kong.yaml
Add, commit and push your changes to your remote git repository.
git add config/argocd-kong.yaml
git commit -m "configure myheader custom kong plugin"
git push origin mainThen reload Kong deployment inside ArgoCD.
Apply the CRD to kubernetes API.
kubectl apply -n httpbin -f kong-plugins/custom.yamlkind delete cluster --name kongManaged by Arthur Diniz and Claudio Oliveira.
Apache 2 Licensed. See LICENSE for full details.
