Skip to content

Instantly share code, notes, and snippets.

View drnic's full-sized avatar
🏆
Platinum Status Level

Dr Nic Williams drnic

🏆
Platinum Status Level
View GitHub Profile
stern -n kube-system -l k8s-app=pi-temperature -s 10m

example

#!/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 November 8, 2019 02:46
Kubernetes the Hard Way, the Easy Way
kubectl
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
#
# 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 September 20, 2019 10:56
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.
---
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 June 19, 2019 14:56
Walk thru for CAB call to create a buildpack for etcd proxy and run it as a Cloud Foundry sidecar

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
@drnic
drnic / update-cf-capi.sh
Last active May 19, 2019 23:02
Upgrade cfdev 0.0.15 to support sidecars (capi 1.79.0)
#!/bin/bash
export BOSH_DEPLOYMENT=${CF_DEPLOYMENT:-cf}
# https://github.com/cloudfoundry/cf-deployment/blob/v7.11.0/operations/use-compiled-releases.yml#L1-L9
capi_update=$(cat <<-YAML
- type: replace
path: /releases/name=capi/url
value: https://storage.googleapis.com/cf-deployment-compiled-releases/capi-1.79.0-ubuntu-xenial-250.29-20190411-165538-039089481.tgz
- type: replace
source "https://rubygems.org"
gem "sinatra"

OSD

./Tools/autotest/sim_vehicle.py -v ArduPlane -L CMAC --map --console --osd
...
Missing SFML libraries - please install libsfml-dev

--osd flag requires libsfml-dev, which can be installed with homebrew sfml package: