https://kubernetes.io/docs/reference/kubectl/cheatsheet/
https://medium.com/faun/be-fast-with-kubectl-1-18-ckad-cka-31be00acc443
https://github.com/twajr/ckad-prep-notes#tasks-from-kubernetes-doc
https://github.com/saaguero/ckad-notes
https://github.com/dgkanatsios/CKAD-exercises
https://github.com/lucassha/CKAD-resources
https://eax.me/vim-commands/
https://discuss.kubernetes.io/t/kubectl-tips-and-tricks/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| terraform { | |
| required_providers { | |
| google = { | |
| source = "hashicorp/google" | |
| version = ">= 3.37" | |
| } | |
| google-beta = { | |
| source = "hashicorp/google-beta" | |
| version = ">= 3.37" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| steps: | |
| # Build image and push to GCR | |
| - name: 'gcr.io/cloud-builders/docker' | |
| id: Build | |
| args: | |
| - 'build' | |
| - '-t' | |
| - 'gcr.io/$PROJECT_ID/$_SERVICE_NAME:$SHORT_SHA' | |
| - '.' | |
| # TODO: look into [images] |
A lot of people land when trying to find out how to calculate CPU usage metric correctly in prometheus, myself included! So I'll post what I eventually ended up using as I think it's still a little difficult trying to tie together all the snippets of info here and elsewhere.
This is specific to k8s and containers that have CPU limits set.
To show CPU usage as a percentage of the limit given to the container, this is the Prometheus query we used to create nice graphs in Grafana:
sum(rate(container_cpu_usage_seconds_total{name!~".*prometheus.*", image!="", container_name!="POD"}[5m])) by (pod_name, container_name) /
Get Started and Create a VM with:
Install k3sup:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for node in node1 node2 node3;do | |
| multipass launch -n $node | |
| done | |
| # Init cluster on node1 | |
| multipass exec node1 -- bash -c "curl -sfL https://get.k3s.io | sh -" | |
| # Get node1's IP | |
| IP=$(multipass info node1 | grep IPv4 | awk '{print $2}') |
This shows the probabilities generated by kube-proxy 1.16 and rendered by iptables for the first 20 of 10k endpoints.
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-JPQESVWHRDCVFZWN
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-43X62NTQK7P33IRX
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-RO4MGPWQFAAAQSOM
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-U4U4WCN32VCO5JFK
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-C4TELCOQRZ66JRHV
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-ARSDZGCR5JG6RCWU
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-QN4E7AOM7AQ62UWM
-A KUBE-SVC-DXWK7ADUC7EUTU7Z -m statistic --mode random --probability 0.00009999983 -j KUBE-SEP-3XQQML7Z2W4L2AI