Skip to content

Instantly share code, notes, and snippets.

View dleske's full-sized avatar

Drew Leske dleske

  • Victoria, Canada
View GitHub Profile
dleske /
Last active September 30, 2023 18:35 — forked from joshuar/
Quick three-node Lustre set-up on CentOS 7
dleske /
Last active November 16, 2022 03:41
k8s: Updating a Secret

Hopefully helped another k8s newbie with the following. The question was, how do you update a single key in a secret in k8s? I don't know anything about secrets but I will probably want to know this in the future, so here we go.

First, to create a dummy secret:

apiVersion: v1
kind: Secret
  name: test-secret
dleske /
Last active February 23, 2018 05:35
k8s: Container Linux breaks Flannel after update/reboot

Original message in kubernetes-novice Slack:

I am using Container Linux with Kubespray and I have found that after a short while new deployments all fail due to pod errors with: Pod sandbox changed, it will be killed and re-created. and subsequently, Failed create pod sandbox. This happens repeatedly. It appears that the issue is due to Container Linux automatically updating itself and rebooting the node. In the end, deployments only work on the masters, which have a No reboots update strategy, but in my understanding this only means the masters will not reboot automatically--the update is still downloaded and if/when the masters are rebooted, they will also be in the same state. I have compared a node that hasn’t yet updated to an updated node and can’t find any differences. Has anybody else seen this?

Took it to #kubespray on advice of a friendly user. Others have seen it but were messing about with routing and such. Furth

dleske / k8s-unable-to-communicate.log
Created February 21, 2018 15:40
k8s unable to communicate log
View k8s-unable-to-communicate.log
E0220 06:48:00.109771 1 event.go:209] Unable to write event: 'Post https://localhost:6443/api/v1/namespaces/default/events: dial tcp getsockopt: connection refused' (may retry after sleeping)
E0220 06:48:00.109837 1 reflector.go:205] Failed to list *core.Service: Get https://localhost:6443/api/v1/services?limit=500&resourceVersion=0: dial tcp getsockopt: connection refused
E0220 06:48:00.109978 1 reflector.go:205] Failed to list *core.Endpoints: Get https://localhost:6443/api/v1/endpoints?limit=500&resourceVersion=0: dial tcp getsockopt: connection refused
E0220 06:48:01.110568 1 reflector.go:205] Failed to list *core.Service: Get https://localhost:6443/api/v1/services?lim
dleske /
Created February 22, 2018 19:06
Kubernetes Cheat Sheet
dleske /
Created February 12, 2020 17:39
Dirty Dict for Python
class DirtyDict(dict):
DirtyDict behaves (hopefully) like a regular dict but overrides mutator
methods to mark the dictionary dirty. In this way changes to the data are
tracked in order to, for example, keep related database objects in sync.
def __init__(self, *args, **kwargs):
self._dirty = False
self._created = []
dleske /
Last active September 15, 2020 18:04
Trigger Docker image rebuild on upstream update
# Checks if upstream image has been updated, and if so, triggers automatic build
# on Dockerhub. Use this for official images, which are no longer directly supported
# by Dockerhub's automatic builds.
# Assumes presence of "notify" script which takes a title, message, and optional
# reference URL.
# Create a build trigger in your Docker Hub repository via
dleske / Makefile
Last active February 16, 2022 19:11
pdoc/mako template for generating simple Markdown documentation from Python docstring
View Makefile
docs/ myapp/ misc/pdoc-templates/text.mako
@pdoc3 --template-dir=misc/pdoc-templates myapp.$* > $@
docs: docs/ docs/
dleske /
Created October 23, 2022 21:10
Python script to parse certificate data from Terraform output
#!/usr/bin/env python3
# Reads certificate information from Terraform output and creates certificate
# files ready for use.
# If Terraform variable for certificates is defined like:
# variable certificates {
# type = map(string)
# default = {}
dleske / harbor-2.8.2-install-support-systemd.patch
Created July 27, 2023 00:05
Patch for Harbor 2.8.2's install script to support systemd
View harbor-2.8.2-install-support-systemd.patch
diff -uNr harbor.orig/ harbor/
--- harbor.orig/ 2023-06-02 11:46:12.000000000 +0000
+++ harbor/ 2023-07-26 18:04:48.666624099 +0000
@@ -19,6 +19,8 @@
# trivy is not enabled by default
+# assume no systemd for now