Skip to content

Instantly share code, notes, and snippets.

@alexeldeib
alexeldeib / deploy.yaml
Created June 25, 2020 17:41
List deployments in all namespaces
---
apiVersion: v1
kind: ServiceAccount
metadata:
creationTimestamp: null
name: lister
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
@alexeldeib
alexeldeib / demo.sh
Last active July 1, 2020 18:02
Kubernetes ingress <-> service <-> pod IP association example
ace@ace-vm:~/code/ocsp-demo$ kubectl -n ingress-nginx get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ingress-nginx-controller LoadBalancer 10.0.14.106 20.193.19.114 80:31377/TCP,443:32598/TCP 3m45s
ingress-nginx-controller-admission ClusterIP 10.0.117.203 <none> 443/TCP 3m46s
ace@ace-vm:~/code/ocsp-demo$ kubectl -n ingress-nginx get svc,pod
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/ingress-nginx-controller LoadBalancer 10.0.14.106 20.193.19.114 80:31377/TCP,443:32598/TCP 3m48s
service/ingress-nginx-controller-admission ClusterIP 10.0.117.203 <none> 443/TCP 3m49s
@alexeldeib
alexeldeib / logs.sh
Created August 20, 2020 22:05
AKS temp disk root + Azure Monitor debugging
ace@ace-vm:~$ kubectl exec -it debug-864678bff9-p79kb -c ubuntu -- bash -c "nsenter -t 1 -a bash"
root@aks-nodepool1-38090526-vmss000000:/# docker info
Client:
Debug Mode: false
Server:
Containers: 16
Running: 15
Paused: 0
Stopped: 1
@alexeldeib
alexeldeib / machine-deployment.yaml
Last active September 13, 2020 06:21
CAPZ join to AKS control plane manifest
apiVersion: cluster.x-k8s.io/v1alpha3
kind: MachineDeployment
metadata:
name: ${CLUSTER_NAME}-md-0
namespace: default
spec:
clusterName: ${CLUSTER_NAME}
replicas: ${WORKER_MACHINE_COUNT}
selector:
matchLabels: null
@alexeldeib
alexeldeib / model.json
Created October 7, 2020 19:07
AKS-Engine DNS debugging
{
"apiVersion": "vlabs",
"properties": {
"orchestratorProfile": {
"orchestratorType": "Kubernetes",
"orchestratorVersion": "1.18.8",
"kubernetesConfig": {
"loadBalancerSku": "Standard",
"excludeMasterFromStandardLB": true,
"useManagedIdentity": true,
@alexeldeib
alexeldeib / NC64as_T4_v3.json
Created October 23, 2020 20:49
Azure GPU SKU
{
"apiVersions": null,
"capabilities": [
{
"name": "MaxResourceVolumeMB",
"value": "2883584"
},
{
"name": "OSVhdSizeMB",
"value": "1047552"
@alexeldeib
alexeldeib / example.sh
Last active December 10, 2020 21:52
Enumerate non-pod processes on Kubernetes node
#!/bin/bash
KUBEPOD_CGROUP="kubepods"
# select all pids where the executable of the pid is a link to a file (this filters out kernel processes we don't care about)
non_kernel_pids="$(find -L /proc/[0-9]*/exe ! -type l | cut -d / -f3 | paste -sd " ")"
# filter out pods by checking that the proc is in whatever cgroup is configured for pods.
non_pods=""; for pid in $non_kernel_pids; do if [ -z "$(grep "$KUBEPOD_CGROUP" /proc/$pid/cgroup)" ]; then non_pods="$non_pods $pid"; fi; done
@alexeldeib
alexeldeib / model.json
Created December 18, 2020 01:11
example model
{
"apiVersion": "vlabs",
"location": "westus2",
"properties": {
"orchestratorProfile": {
"orchestratorType": "Kubernetes",
"orchestratorVersion": "1.18.13",
"kubernetesConfig": {
"loadBalancerSku": "Standard",
"excludeMasterFromStandardLB": true,
@alexeldeib
alexeldeib / README.md
Created January 2, 2021 23:10
Vault Operator

README

@alexeldeib
alexeldeib / rbac.yaml
Created January 20, 2021 02:30
RBAC case-sensitivity demonstration
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: config-map
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: config-map