Contains code for all the demonstrations in the Containerizing legacy applications with dynamic file-based configurations and secrets talk that I delivered at DevOps Days Toronto 2019 and DevOps Days Boston 2019.
- Stern for tailing multiple pod logs
- Helm client
- Docker
- Kubernetes
- Via Docker for Mac (tested)
- Minikube*
Currently there are default values for the Helm charts that point to the Docker for Mac host to access the local Docker registry from Kubernetes, so you will need to override this as appropriate
To store the Docker images that are built as part of the demos you will need a local Docker registry (which itself runs in Docker)
docker run -d -p 5000:5000 --restart=always --name registry registry:2
Alternatively you modify the scripts to push/pull from your own Docker Hub account if you so desire.
If you choose to push/pull images from Docker Hub as opposed to a local registry you will need to add your Docker Hub credentials as a secret to Kubernetes. By default you won't need to do this for the demos.
kubectl create secret docker-registry regcred --docker-server=https://index.docker.io/v1/ --docker-username=[username] --docker-password=[password] --docker-email=[email]
Once you've installed Helm you'll need to initialize it on Kubernetes.
helm init --history-max 200
Outcome of this demo is to prove that the MyBB codebase downloaded from mybb.com will run using the PHP built-in development web server.
./0_local.sh
Coming soon...
Outcome of this demo is to show a basic Docker image build and that MyBB runs on a local Docker host (with some caveats)
./1_docker.sh
Outcome of this demo is to run MyBB in multiple containers, a PHP/Apache container and a MySQL container. This is spun up using Docker Compose. This only demonstrates that MyBB can communicate between containers using host networking.
./2_compose.sh
export PATH=$PATH:/Applications/MySQL\ Workbench.app/Contents/MacOS
Outcome of this demo is to run MyBB in multiple containers but with multiple load-balanced PHP/Apache containers and an overlay network. This is spun up using Docker Swarm.
./3_swarm.sh
Coming soon...
Outcome of this demo is to run MyBB in multiple containers but to Kubernetes.
./4_k8s.sh
Coming soon...
Outcome of this demo is to deploy MyBB to Kubernetes using Helm charts for the MyBB/Apache container and community Helm charts for MySQL and additionally Memcache. Helm is used to pass template variables into the ConfigMap used to generate configuration at deployment time.
./5_helm.sh
Coming soon...
Outcome of this demo is to deploy MyBB to Kubernetes as above alongside Consul and Vault installed using community Helm charts. This involves using Consul Template to dynamically generate configuration.
./6_dynamic.sh
https://learn.hashicorp.com/consul/getting-started-k8s/minikube
https://github.com/helm/charts/tree/master/incubator/vault
replicaCount: 1
Coming soon...
Outcome of this demo is to deploy MyBB to Kubernetes with Consul and Vault as above but using Consul ESM to register external services like MySQL and Memcache, and using the database secrets engine to automatically rotate MySQL credentials.
./7_rotation.sh
Coming soon...
Replace from-file ConfigMap information
kubectl create configmap mybb-configmap --from-file configuration/settings.php --from-file \
configuration/config_k8s.php -o yaml --dry-run | kubectl replace -f -
Force a pod to destroy
kubectl delete pod [name] --grace-period=0 --force
List items in memcache
echo "stats items" | ncat 127.0.0.1 11211