Skip to content

Instantly share code, notes, and snippets.

Avatar
🏆
Platinum Status Level

Dr Nic Williams drnic

🏆
Platinum Status Level
  • Brisbane, Australia
  • Twitter @drnic
View GitHub Profile
@drnic
drnic / Procfile
Last active Feb 9, 2020
Deploy https://jupyter.org/ Jupyter Lab to Cloud Foundry
View Procfile
web: jupyter lab --ip 0.0.0.0 --port $PORT --no-browser
View staff.json
{
"drnic": {"joined": 2012},
"bob": {"joined": 2020}
}
View README.md
$ kaf generate-secret.yaml
$ k get secret my-internal-secret -n kubecf -ojsonpath='{.data.password}' | base64 --decode
CDVIqCF7LY6dLyEGq10BrzaZfRWGDl8dxSV4vuVz8eDGga8AoP84SEc22Ben25mM

Now rotate secret:

$ kaf rotate-my-internal-secret.yaml
View all-the-pi-at-right-temp.md
stern -n kube-system -l k8s-app=pi-temperature -s 10m

example

View k3sup-gce.sh
#!/bin/bash
set -u
up() {
INSTANCE_TYPE=${INSTANCE_TYPE:-n1-standard-1}
(
set -x
gcloud compute instances create k3s-1 \
@drnic
drnic / .gitignore
Last active Nov 8, 2019
Kubernetes the Hard Way, the Easy Way
View kubecf-deployment.txt
NAME READY STATUS RESTARTS AGE
cf-operator-7db586b9c6-28pxq 1/1 Running 0 79m
kwt-net 1/1 Running 0 37m
scf-adapter-v1-0 5/5 Running 0 65m
scf-api-v1-0 17/17 Running 11 65m
scf-bits-v1-0 7/7 Running 0 65m
scf-bosh-dns-6b95f54976-7kq9z 1/1 Running 0 66m
scf-bosh-dns-6b95f54976-99qq2 1/1 Running 0 66m
scf-cc-worker-v1-0 5/5 Running 6 65m
scf-database-v1-0 5/5 Running 0 66m
View kubectl-aliases.sh
#
# source <(curl https://tinyurl.com/kubectl-aliases -L)
#
# This command is used a LOT both below and in daily life
alias k=kubectl
# Execute a kubectl command against all namespaces
alias kca='f(){ kubectl "$@" --all-namespaces; unset -f f; }; f'
@drnic
drnic / serviceaccount-docker-github.yaml
Created Sep 20, 2019
Sample Kubernetes serviceaccount including GitHub (remember to use Personal Auth Token, not Username/Password if you've got 2FA enabled) and Docker Hub. Used for a kpack demonstration.
View serviceaccount-docker-github.yaml
---
apiVersion: v1
kind: Secret
metadata:
name: dockerhub
annotations:
build.pivotal.io/docker: index.docker.io
type: kubernetes.io/basic-auth
stringData:
username: <username/email>
@drnic
drnic / buildpack-sidecar-walkthru.md
Last active Jun 19, 2019
Walk thru for CAB call to create a buildpack for etcd proxy and run it as a Cloud Foundry sidecar
View buildpack-sidecar-walkthru.md

Distributing sidecars with buildpacks

Slides are at https://speakerdeck.com/drnic/distributing-cloud-foundry-sidecars-with-buildpacks

What are sidecars? How to use them in Cloud Foundry? - by Tim Downey

Intro to sidecars from last CAB

  • until recently a running app container only ran and monitored a single process
  • You could manually fork off child processs but they weren’t monitored (static file buildpack starts nginx and also starts cat-ting logs to stdout
  • Secondary processes inside containers are now first class citizens