Skip to content

Instantly share code, notes, and snippets.

@alexeldeib
alexeldeib / bootstrap.sh
Created March 24, 2020 07:59
Azure DevOps Agent Joining
#!/usr/bin/env bash
#
#
# Script to bootstrap an Azure DevOps Agent noninteractively
#
#
set -o pipefail
set -o errexit
set -o nounset
@alexeldeib
alexeldeib / .envrc
Last active April 2, 2020 09:50
Example Cluster API AKS deployment
# Azure settings.
export AZURE_LOCATION="southcentralus"
export AZURE_RESOURCE_GROUP="ace-test"
export AZURE_TENANT_ID=""
export AZURE_CLIENT_ID=""
export AZURE_CLIENT_SECRET=""
export AZURE_SUBSCRIPTION_ID=""
export SSH_PUBLIC_KEY="$(cat /home/ace/.ssh/id_rsa.pub)"
# Cluster settings.
@alexeldeib
alexeldeib / calico.yaml
Created April 7, 2020 17:30
Azure Calico VXLAN
---
# Source: calico/templates/calico-config.yaml
# This ConfigMap is used to configure a self-hosted Calico installation.
kind: ConfigMap
apiVersion: v1
metadata:
name: calico-config
namespace: kube-system
data:
# Typha is disabled.
@alexeldeib
alexeldeib / sysctl.yaml
Created April 9, 2020 17:02
Pod sysctls
apiVersion: apps/v1
kind: Deployment
metadata:
name: &name sysctl
labels:
app: *name
spec:
replicas: 1
selector:
matchLabels:
@alexeldeib
alexeldeib / cross-ns-ingress.yml
Created May 11, 2020 09:42
Cross-namespace Ingress via External Name
---
# Deployment to serve backend requests
apiVersion: apps/v1
kind: Deployment
metadata:
name: healthz
namespace: default
labels:
app: healthz
spec:
@alexeldeib
alexeldeib / log.sh
Created May 22, 2020 05:58
CAPZ log dump
root@ace-pool-mp-0000002:~# kubeadm join -v=7 --config /tmp/kubeadm-join-config.yaml
W0522 05:56:34.830866 19897 join.go:346] [preflight] WARNING: JoinControlPane.controlPlane settings will be ignored when control-plane flag is not set.
I0522 05:56:34.830938 19897 join.go:371] [preflight] found NodeName empty; using OS hostname as NodeName
I0522 05:56:34.830956 19897 joinconfiguration.go:75] loading configuration from "/tmp/kubeadm-join-config.yaml"
W0522 05:56:34.831206 19897 common.go:77] your configuration file uses a deprecated API spec: "kubeadm.k8s.io/v1beta1". Please use 'kubeadm config migrate --old-config old.yaml --new-config new.yaml', which will write the new, similar spec using a newer API version.
I0522 05:56:34.832067 19897 initconfiguration.go:103] detected and using CRI socket: /run/containerd/containerd.sock
[preflight] Running pre-flight checks
I0522 05:56:34.832160 19897 preflight.go:90] [preflight] Running general checks
I0522 05:56:34.832211 19897 checks.go:249] validating
@alexeldeib
alexeldeib / test.sh
Last active May 28, 2020 10:59
qemu kvm test setup
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
set -x
SSH_OPTS="-o PasswordAuthentication=no -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ConnectTimeout=5"
function vm_ssh() {
@alexeldeib
alexeldeib / patch.out
Created May 28, 2020 22:03
fix: pointer conversion
From 46f45b47c6635d35c65daefcd6945cb2848df80f Mon Sep 17 00:00:00 2001
From: Alexander Eldeib <[email protected]>
Date: Thu, 28 May 2020 15:02:17 -0700
Subject: [PATCH] fix: pointer conversion
Signed-off-by: Alexander Eldeib <[email protected]>
---
api/v1alpha2/azurecluster_conversion.go | 53 +++++++----------
api/v1alpha2/zz_generated.conversion.go | 78 ++++++++++++++++++-------
2 files changed, 80 insertions(+), 51 deletions(-)
@alexeldeib
alexeldeib / metrics-server.yaml
Last active June 7, 2020 04:43
Prometheus install slim
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: system:aggregated-metrics-reader
labels:
rbac.authorization.k8s.io/aggregate-to-view: "true"
rbac.authorization.k8s.io/aggregate-to-edit: "true"
rbac.authorization.k8s.io/aggregate-to-admin: "true"
rules:
@alexeldeib
alexeldeib / dash.yaml
Created June 6, 2020 23:37
Snapshot of prometheus operator dashboards + rules
This file has been truncated, but you can view the full file.
apiVersion: v1
data:
config.yaml: |
resourceRules:
cpu:
containerQuery: sum(rate(container_cpu_usage_seconds_total{<<.LabelMatchers>>,container!="POD",container!="",pod!=""}[5m])) by (<<.GroupBy>>)
nodeQuery: sum(1 - rate(node_cpu_seconds_total{mode="idle"}[5m]) * on(namespace, pod) group_left(node) node_namespace_pod:kube_pod_info:{<<.LabelMatchers>>}) by (<<.GroupBy>>)
resources:
overrides:
node: