Let's look at some basic kubectl output options.
Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).
We can start with:
kubectl get no
| --- | |
| ################################################################################ | |
| ## K8S Default Backend for Nginx if no endpoint is available e.g. 404 servers | |
| ############################################################################### | |
| apiVersion: extensions/v1beta1 | |
| kind: Deployment | |
| metadata: | |
| name: nginx-default-backend | |
| namespace: kube-system | |
| labels: |
| resource "aws_iam_policy" "terraform_create_policy" { | |
| name = "terraform_create_policy" | |
| path = "/" | |
| policy = "${data.aws_iam_policy_document.terraform_create_policy.json}" | |
| } | |
| data "aws_iam_policy_document" "terraform_create_policy" { | |
| statement { | |
| sid = "1" | |
| actions = [ |
Note: "Forked" from Latency Numbers Every Programmer Should Know
| Event | Nanoseconds | Microseconds | Milliseconds | Comparison |
|---|---|---|---|---|
| L1 cache reference | 0.5 | - | - | - |
| Branch mispredict | 5.0 | - | - | - |
| L2 cache reference | 7.0 | - | - | 14x L1 cache |
| Mutex lock/unlock | 25.0 | - | - | - |
| {{- $stage := .Values.stage }} | |
| {{- range $pod := .Values.topology.pods }} | |
| --- | |
| apiVersion: extensions/v1beta1 | |
| kind: Deployment | |
| metadata: | |
| name: '{{ template "fullname" $ }}-{{ $pod.name | replace "_" "-" }}-{{ $pod.tier }}' | |
| labels: | |
| release: "{{ $.Release.Name }}" | |
| chart: '{{ $.Chart.Name }}-{{ $.Chart.Version | replace "+" "-" }}' |
| kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod |
abs(float) - Returns the absolute value of a given float.
Example: abs(1) returns 1, and abs(-1) would also return 1,
whereas abs(-3.14) would return 3.14. See also the signum function.
basename(path) - Returns the last element of a path.
base64decode(string) - Given a base64-encoded string, decodes it and
returns the original string.
Setup a single node Kubernetes cluster for development using kubeadm: https://kubernetes.io/docs/setup/independent/install-kubeadm/
Create a CentOS 7 or Ubuntu Xenial (16.04) machine, and run kubeadm.sh as root.
You can pass this script as user-data to cloud-init so that it will be automatically run. For example, on openstack:
openstack server create NAME --flavor FLAVOR --key-name KEY --image 'Ubuntu Xenial' --network NET --security-group SECGROUP --user-data kubeadm.sh