Best practices
https://github.com/neilpricetw/kubernetes-security-nodejs-mysql
Container orchestration

Container orchestration is the automation of deploying managing containers, e.g. connectivity between containers, vertical scaling (increasing container resources based on load).
Architectural concepts
Node
A machine, either physical or virtual, on which k8s is installed. A node is a worker machine, and is where containers will be launched by k8s. Nodes have been referred to as minions in the past.
Cluster
A set of nodes grouped together. Now, if one node fails, our application is still accessible via the other nodes in the cluster. Multiple nodes in a cluster helps share load.
Master node
A node that is configured to handle the orchestration of worker nodes in the cluster.
Components of a k8s installation
API Server
The “front-end” of k8s. Users, management devices, CLIs all talk to k8s through this.
etcd
etcd is a distributed key-value store used by k8s to manage the cluster. etcd is used to track metadata about worker nodes and master nodes in the cluster, and this data is stored across all master nodes in the cluster.
Scheduler
Responsible for distributing work or containers across multiple nodes in the container. It looks for newly created containers and assigns them to nodes.
Controller
The brain behind the orchestration. The controller is responsible for noticing and responding when nodes/containers/endpoints go down. The controller makes decisions about when to bring up new containers.
Container runtime
The underlying software used to run containers, e.g. Docker.
Kubelet
The agent that runs on each cluster. The agent is responsible for making sure that containers are running inside the nodes as expected.
Distribution of components across master and worker nodes

Patterns
Service mesh
Find ingress details (including path)
kubectl get ingress/{service name} -o yaml -n {namespace}
`kubectl get deploy/
Debugging
hpa- stands for Horizontal Pod Autoscaler
kubens - get namespaces
kube-system - some admin-ish namespace
kubens kube-system
kubectl get {pod/service/namespace/replicaset/deployments/hpa} - get a list of all of the things
kubectl edit {pod/service/namespace/replicaset/deployments/hpa} {thing name} - edit the thing
kubectl get pod → ingress-appgw-deployment-something - ingress controller - some kind of routing pod
kubectl logs -f {ingress-appgw-deployment-something} | grep -C 20 {my pod name} - tail logs, searching for logs with my pod name
kubectl describe {pod/service/replicaset/deployments} {thing name} - describe this individual thing in detail
Tail logs across all pods that match a regex
e.g. I have a replicaset called foo with 3 pods; foo-7dsa56, foo-9df8as7, and foo-fsd67a, I can run stern foo to tail logs across all 3 pods.
Content-CheatsheetKubernetes-horizontal.pdf
Content-CheatsheetKubernetes.pdf
Authenticate against a cluster in Azure AKS
az login --use-device-code
az account set --subscription {insert subscription here}
az aks get-credentials -n {cluster name} -g {resource group} -a