Skip to content

Instantly share code, notes, and snippets.

@KashifSaadat
KashifSaadat / kube-reserved-resources-debugging.sh
Created March 15, 2019 16:40
Helpful debugging commands for Kube Reserved Resources & CGroups
# Query current usage for runtime, kubelet and pods
curl -s http://localhost:10255/stats/summary | jq .node.systemContainers
# Quick scan of the cgroup paths to see what does exist
ls -ld /sys/fs/cgroup/**/podruntime.slice
ls -ld /sys/fs/cgroup/**/system.slice
# Validate what cgroup a single process uses
cat /proc/$(pidof kubelet)/cgroup
@KashifSaadat
KashifSaadat / nodeSpec.diff
Created January 24, 2018 12:47
Supporting new AWS Availability Zones in kops - InstanceGroupSpec
apiVersion: kops/v1alpha2
kind: InstanceGroup
metadata:
labels:
kops.k8s.io/cluster: test.k8s.appvia.io
name: nodes
spec:
image: coreos.com/CoreOS-stable-1576.5.0-hvm
machineType: t2.medium
maxSize: 2
@KashifSaadat
KashifSaadat / etcd-member-list-started.txt
Created January 24, 2018 12:46
Supporting new AWS Availability Zones in kops - ETCD Member List (started)
➜ ${ETCD_MAIN} member list -w table
+------------------+---------+---------+--------------------------------------------------+--------------------------------------------------+
| ID | STATUS | NAME | PEER ADDRS | CLIENT ADDRS |
+------------------+---------+---------+--------------------------------------------------+--------------------------------------------------+
| 2b3a90056d935bd9 | started | etcd-a2 | https://etcd-a2.internal.test.k8s.appvia.io:2380 | https://etcd-a2.internal.test.k8s.appvia.io:4001 |
| 356cb0ee3ba9d1f6 | started | etcd-c1 | https://etcd-c1.internal.test.k8s.appvia.io:2380 | https://etcd-c1.internal.test.k8s.appvia.io:4001 |
| 3798da06fbf85375 | started | etcd-a1 | https://etcd-a1.internal.test.k8s.appvia.io:2380 | https://etcd-a1.internal.test.k8s.appvia.io:4001 |
| 4e65c79f2332a2ae | started | etcd-c2 | https://etcd-c2.internal.test.k8s.appvia.io:2380 | https://etcd-c2.internal.test.k8s.appv
@KashifSaadat
KashifSaadat / etcd-config-update.sh
Created January 24, 2018 12:45
Supporting new AWS Availability Zones in kops - ETCD Config Updates
# Stop the kubelet & protokube services, preventing automatic updates to the etcd config or the containers from restarting
systemctl stop kubelet && systemctl stop protokube
# Terminate any running etcd containers
docker kill $(docker ps | grep "etcd" | awk '{print $1}')
# Update the etcd configurations, setting ETCD_INITIAL_CLUSTER_STATE to existing
sed -i -e "s/value\: new/value: existing/g" /etc/kubernetes/manifests/etcd.manifest
sed -i -e "s/value\: new/value: existing/g" /etc/kubernetes/manifests/etcd-events.manifest
@KashifSaadat
KashifSaadat / etcd-member-list-unstarted.txt
Created January 24, 2018 12:42
Supporting new AWS Availability Zones in kops - ETCD Member List (unstarted)
➜ ${ETCD_MAIN} member list -w table
+------------------+-----------+---------+--------------------------------------------------+--------------------------------------------------+
| ID | STATUS | NAME | PEER ADDRS | CLIENT ADDRS |
+------------------+-----------+---------+--------------------------------------------------+--------------------------------------------------+
| 2b3a90056d935bd9 | started | etcd-a2 | https://etcd-a2.internal.test.k8s.appvia.io:2380 | https://etcd-a2.internal.test.k8s.appvia.io:4001 |
| 356cb0ee3ba9d1f6 | unstarted | | https://etcd-c1.internal.test.k8s.appvia.io:2380 | |
| 3798da06fbf85375 | started | etcd-a1 | https://etcd-a1.internal.test.k8s.appvia.io:2380 | https://etcd-a1.internal.test.k8s.appvia.io:4001 |
| 4e65c79f2332a2ae | unstarted | | https://etcd-c2.internal.test.k8s.appvia.io:2380 |
@KashifSaadat
KashifSaadat / etcd-status.txt
Last active January 24, 2018 12:40
Supporting new AWS Availability Zones in kops - ETCD Endpoint Status
➜ ${ETCD_MAIN} endpoint status -w table
+------------------------+------------------+---------+---------+-----------+-----------+------------+
| ENDPOINT | ID | VERSION | DB SIZE | IS LEADER | RAFT TERM | RAFT INDEX |
+------------------------+------------------+---------+---------+-----------+-----------+------------+
| https://localhost:4001 | 3798da06fbf85375 | 3.0.17 | 3.7 MB | true | 57 | 67900 |
+------------------------+------------------+---------+---------+-----------+-----------+------------+
➜ ${ETCD_EVENTS} endpoint status -w table
+------------------------+------------------+---------+---------+-----------+-----------+------------+
| ENDPOINT | ID | VERSION | DB SIZE | IS LEADER | RAFT TERM | RAFT INDEX |
@KashifSaadat
KashifSaadat / etcd_cmd.sh
Created January 24, 2018 12:38
Supporting new AWS Availability Zones in kops - ETCDv3 CMD
export ETCDCTL_API=3
ETCD_MAIN="etcdctl --cacert /srv/kubernetes/ca.crt --endpoints https://localhost:4001"
ETCD_EVENTS="etcdctl --cacert /srv/kubernetes/ca.crt --endpoints https://localhost:4002"
@KashifSaadat
KashifSaadat / etcdClusterSpec.diff
Last active January 24, 2018 12:48
Supporting new AWS Availability Zones in kops - EtcdClusterSpec
etcdClusters:
- enableEtcdTLS: true
etcdMembers:
- instanceGroup: eu-west-2a-master1
name: a1
- instanceGroup: eu-west-2a-master2
name: a2
- instanceGroup: eu-west-2a-master3
name: a3
- instanceGroup: eu-west-2b-master1
@KashifSaadat
KashifSaadat / subnetSpec.diff
Last active January 24, 2018 12:49
Supporting new AWS Availability Zones in kops - SubnetSpec
subnets:
— cidr: 10.100.0.0/24
name: eu-west-2a
type: Public
zone: eu-west-2a
— cidr: 10.100.1.0/24
name: eu-west-2b
type: Public
zone: eu-west-2b
+ — cidr: 10.100.2.0/24

Keybase proof

I hereby claim:

  • I am KashifSaadat on github.
  • I am kashifsaadat (https://keybase.io/kashifsaadat) on keybase.
  • I have a public key whose fingerprint is 4026 19E2 D4ED 8F83 61FF 0BE7 257C 095A B39B 0D29

To claim this, I am signing this object: