In this section, we will be deploying a local instance of the flask wrapper Docker image.
From the serve-yourself infrastructure requirements, local k8s testbed will be MISSING the following requirements:
- IDENTITY: No OAuth2 SSO login , due to the lack of signed certificates and valid domains.
- NETWORK: Since we're local, the output is placed on a reserved port on localhost
- COST: Because it's your own machine, there's no cost to you except for the electricity.
TODO: Add basic generated token as a requirement for calling the endpoint.
- Install kind from https://kind.sigs.k8s.io/docs/user/quick-start/#installation
- Modify the Docker image specified in line 20 of deployment.yaml to the location of the Docker registry where you have stored the example serve-yourself docker image
- Run the following command:
This command will bring up the local k8s cluster, deploy a simple load balanced instance of the Docker image specified in line 20 of deployment.yaml, test the endpoint, and then, if successful, tear down cluster.
make
- Install package to create a local k8s cluster for testing Follow directions on https://kind.sigs.k8s.io/docs/user/quick-start/#installing-from-release-binaries
- Create local cluster with kind:
/usr/local/bin/kind create cluster
- Create local pod:
kubectl run simple-cms --labels="name=simple-cms" --image=jetstack/simple-cms:1.0.0 kubectl run simple-hello-world --labels="name=simple-hello-world" --image=nginxdemos/hello:latest
- Confirm pod exists:
kubectl get pod
- Create front-end service router:
k apply -f service.yaml k apply -f service-hello-world.yaml
- Access endpoint from port forward
OR
kubectl port-forward services/simple-cms 8081:80
kubectl port-forward services/simple-hello-world 8081:80
- Test output in different terminal:
curl http://localhost:8081