Today infrastructure is more about choose of tools rather than developing yourself. IT today is about higher level services.
Kubernetes is an abstraction for containers. It enables to treat a entire cluster like a single machine.
Pod have an IP address and can access volumes, they are apps containers.
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 after loading the secrets
and configmap
on the master node.
Service is another level of abstraction: it is 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] |
Port forwarding between the cluster and the master machine.
1 | kubectl port-forward monolith 10080:80 |
Executing 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] |