Infrastructure today is more about choosing tools than building them yourself. IT has moved up to higher-level services.
Kubernetes is an abstraction over containers. It lets you treat an entire cluster as if it were a single machine.
Pods have an IP address and can access volumes; they are the containers your apps run in.
Using nginx to reverse proxy the app in HTTPS:
Monitoring and health checks: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/
Configuration: http://kubernetes.io/docs/user-guide/configmap/
Secrets: http://kubernetes.io/docs/user-guide/secrets/
Configuration and secrets files are accessed through mounted volumes defined in the Kubernetes YAML configuration file, once the secrets and configmap have been loaded on the master node.
A service is another level of abstraction: a set of identical pods.
Services: http://kubernetes.io/docs/user-guide/services/
Sample configuration files: https://github.com/udacity/ud615/tree/master/kubernetes
Useful commands
Create a Kubernetes cluster.
1 | gcloud container clusters create k0 |
Create a pod.
1 | kubectl create -f [yaml-file] |
Forward a port between the cluster and the master machine.
1 | kubectl port-forward monolith 10080:80 |
Execute a command from within the container.
1 | kubectl exec monolith --stdin --tty -c monolith /bin/sh |
Setting nginx configuration and TLS keys.
1 | kubectl create secret generic [name] --from-file=[folderls] |
Create a service
1 | kubectl create -f [yaml-file of type NodePort] |