Workload Orchestration
Twine
Kubernetes
- https://kubernetes.io/
- https://kubernetes.io/docs/concepts/configuration/overview/#general-config-tips
- Kubernetes post-mortems
Master -> Node + Node processes
Deployment -> (service -> ) pod (on a node) -> containers/volumes
Kubectl
Cluster
# get cluster info
kubectl cluster-info
# get list of nodes
kubectl get nodes
Deployments
# create a deployment
kubectl run NAME --image=...
# see deployments
kubectl get deployments
Pods
Think of a pod as a logical host
# list pods
kubectl get pods
# run a command on a pod
kubectl exec $POD_NAME COMMAND
# label a pod
kubectl label pod $POD_NAME app=v1
Networking
# Open a proxy to the internal network
kubectl proxy
kubectl expose TYPE/NAME
# Forward port 8081 to a deployment
kubectl port-forward deployment/foobar 8082
Logs
kubectl logs $POD_NAME
Services
A logical collection of pods
Type | Description |
---|---|
ClusterIP | |
NodePort | |
LoadBalancer | A load balancer |
ExternalName |
# list services
kubectl get services
# delete services
kubectl delete service
DaemonSets
Long-running processes, generally monitoring/logging. Can come up first, and go down safely at reboot/shutdown.
Namespaces
# list namespaces
kubectl get namespaces
# get detailed namespace info
kubectl describe namespace NAMESPACE
# create context from namespace
kubectl config set-context # ...
# Switch context
kubectl config use-context NAMESPACE
# Get current context
kubectl config current-context
Secrets
# Create generic secret from literal value
kubectl create secret generic OBJECTNAME --from-literal=KEYNAME=LITERAL_VALUE
https://kubernetes.io/docs/concepts/configuration/secret/
Misc
# Check control plane health
kubectl get componentstatus
minikube
https://github.com/kubernetes/minikube
Master -> Node -> Node processes
minikube start
k3
metrics-server
https://github.com/kubernetes-incubator/metrics-server https://kubernetes.io/docs/tasks/debug-application-cluster/core-metrics-pipeline/
heapster
https://github.com/kubernetes/heapster
deprecated Kubernetes 1.11, retired in Kubernetes 1.13
collects metrics from cadvisor
cadvisor
https://hub.docker.com/r/google/cadvisor/
collects resource/perf metrics from running containers
UI - port was 4194
in Kubernetes 1.11, UI turned off by default
Mesos
Nomad
# view registered nodes
nomad node status
# list servers
nomad server members
# Start a dev server
sudo nomad agent -dev
# run a job
nomad run JOBNAME.nomad
Default web UI port is 4646
cron
crontab
flag | description |
---|---|
-u USER | select different user |
-l | display current crontab |
-r | remove current crontab |
-e | edit current crontab with VISUAL or EDITOR |
Syntax
┌───────────── min (0 - 59)
│ ┌────────────── hour (0 - 23)
│ │ ┌─────────────── day of month (1 - 31)
│ │ │ ┌──────────────── month (1 - 12)
│ │ │ │ ┌───────────────── day of week (0 - 6) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
│ │ │ │ │
│ │ │ │ │
* * * * * command to execute