docs(deploy): add script to test podinfo using kind

This commit is contained in:
Deavon M. McCaffery
2020-11-17 23:04:55 +00:00
parent 046ac8a4a5
commit bc809cd763
3 changed files with 74 additions and 1 deletions
+14 -1
View File
@@ -1,6 +1,7 @@
# Deploy demo webapp
# Deploy demo webapp
Demo webapp manifests:
- [common](webapp/common)
- [frontend](webapp/frontend)
- [backend](webapp/backend)
@@ -30,3 +31,15 @@ Deploy the demo in the `production` namespace:
```bash
kustomize build ./overlays/production | kubectl apply -f-
```
## Testing Locally Using Kind
> NOTE: You can install [kind from here](https://kind.sigs.k8s.io/docs/user/quick-start/#installation)
The following will create a new cluster called "podinfo" and configure host ports on 80 and 443. You can access the
endpoints on localhost. The example also deploys cert-manager within the cluster along with a self-signed cluster issuer
used to generate the certificate to validate the secure port.
```sh
./kind.sh
```
Executable
+49
View File
@@ -0,0 +1,49 @@
#! /usr/bin/env sh
# create the kind cluster
kind create cluster --config=kind.yaml
# add certificate manager
kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.0.4/cert-manager.yaml
# wait for cert manager webhook
kubectl wait --namespace cert-manager \
--for=condition=available deployment \
--selector=app=webhook \
--timeout=120s
# wait for the injector
kubectl wait --namespace cert-manager \
--for=condition=available deployment \
--selector=app=cainjector \
--timeout=120s
# wait for the cert manager
kubectl wait --namespace cert-manager \
--for=condition=available deployment \
--selector=app=cert-manager \
--timeout=120s
# apply the secure webapp
kubectl apply -f ./secure/common
kubectl apply -f ./secure/backend
kubectl apply -f ./secure/frontend
# wait for the podinfo frontend to come up
kubectl wait --namespace secure \
--for=condition=ready pod \
--selector=app=frontend \
--timeout=120s
# curl the endpoints (responds with info due to header regexp on route handler)
echo
echo "http enpdoint:"
echo "curl http://localhost"
echo
curl http://localhost
echo
echo "https (secure) enpdoint:"
echo "curl --insecure https://localhost"
echo
curl --insecure https://localhost
+11
View File
@@ -0,0 +1,11 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
- containerPort: 443
hostPort: 443
protocol: TCP