Kubernetes
Table of Contents
- Educational
- Overview
- Videos
- Monitoring
- Tooling
- Storage
- Controllers/Operators
- FluxCD/ArgoCD
- Eventing
- CNAB (Cloud Native App Bundles)
- Productionizing
- Snippets
- Upgrade kube state metrics
- Create a temp pod on a specific host with tolerations
- Create temp pod
- Copy a secret between namespaces
- List all ingresses
- Get taints on nodes
- Run cron job one off
- Port-forward a service
- Copy from remote container to local
- Add registry credentials to a namespace
- EKSCTL add role to admin
Overview
Monitoring
Tooling
- https://www.0x65.dev/blog/2019-12-14/the-architecture-of-a-large-scale-web-search-engine-circa-2019.html
- https://grafana.com/oss/loki/
- https://www.reddit.com/r/kubernetes/comments/ed88w9/what_are_your_default_addons_that_you_install/
- https://github.com/banzaicloud/bank-vaults/tree/master/docs/mutating-webhook
- https://github.com/derailed/popeye
- https://cdk8s.io/
Controllers/Operators
FluxCD/ArgoCD
Eventing
CNAB (Cloud Native App Bundles)
Productionizing
Snippets
Upgrade kube state metrics
1 | helm upgrade ksm prometheus-community/kube-state-metrics |
Create a temp pod on a specific host with tolerations
1 2 3 4 5 6 | kubectl run -i --rm --tty busy7 --image=alpine:latest --overrides='{"spec": { "nodeSelector": {"kubernetes.io/hostname": "HOSTNAME"}, "tolerations": [{ "key": "TAINT_NAME", "operator": "Equal", "value": "true", "effect": "NoSchedule" }]}}' -- sh |
Create temp pod
1 | kubectl run -i --rm --tty temp --image=alpine:latest -- sh |
Copy a secret between namespaces
1 | kubectl get secret secret-name --namespace=from-ns -o yaml | sed 's/namespace: from-ns/namespace: to-ns/g' | kubectl apply --namespace=to-ns -f - |
List all ingresses
1 | kubectl get ing -o json | jq -r '.items[].spec.rules[].http.paths[]' |
Get taints on nodes
1 | kubectl get nodes -o json | jq '.items[].spec.taints' |
Run cron job one off
1 | kubectl create job --from=cronjob/<name of cronjob> <name of job> |
Port-forward a service
1 | kubectl port-forward svc/name-of-svc local_port:pod_port |
Copy from remote container to local
1 | kubectl cp <some-namespace>/<some-pod>:/tmp/foo /tmp/bar |
Add registry credentials to a namespace
1 2 3 4 5 6 | export REGISTRY_USERNAME="username" export REGISTRY_PASSWORD="password" export NAMESPACE="default" kubectl create secret -n $NAMESPACE docker-registry --docker-server=registry.yourdomain.com --docker-username=$REGISTRY_USERNAME \ --docker-password="$REGISTRY_PASSWORD" container-registry kubectl patch sa default -n $NAMESPACE -p '"imagePullSecrets": [{"name": "container-registry" }]' |
EKSCTL add role to admin
1 | eksctl create iamidentitymapping help --name staging --role arn:aws:iam::account_number:role/kube-admin --group system:masters --username admin |