Skip to content

Instantly share code, notes, and snippets.

View StevenACoffman's full-sized avatar

Steve Coffman StevenACoffman

View GitHub Profile
@StevenACoffman
StevenACoffman / Troubleshooting Kubernetes.md
Last active September 26, 2017 04:14
Troubleshooting Kubernetes

This helpful advice was from @tsupertramp

for a in `kubectl get pods  -n kube-system |grep kube-dns |grep -v autoscaler |cut -d ' ' -f 1 `;do for b in kubedns dnsmasq sidecar;do kubectl logs -n kube-system $a -c $b  > $a-$b.log;done;done

=> Then you have logfiles of dns in your current directory. Then just look through the log files if there is anything like “warning” or “error”

It searches your pod names and then shows logs of each pods containers (it has three kubedns / dnsmasq / sidecar)

Then check output of:

curl -k -X GET \
-H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" \
https://$KUBERNETES_PORT_443_TCP_ADDR:$KUBERNETES_SERVICE_PORT_HTTPS
@StevenACoffman
StevenACoffman / README.md
Created July 27, 2017 02:46 — forked from cedricvidal/README.md
Netflix Eureka curl registration

Registration

curl -v -X POST -H "Accept: application/xml" -H "Content-type: application/xml" --data @reg.xml http://localhost:8761/eureka/apps/test

Listing

curl -X GET -H "Accept: application/json" http://localhost:8761/eureka/apps
@StevenACoffman
StevenACoffman / !readme.md
Created August 2, 2017 01:19 — forked from dougbtv/!readme.md
You had ONE JOB -- A Kubernetes job.

You had ONE JOB -- A Kubernetes job.

Let's take a look at how Kubernetes jobs are crafted. I had been jamming some kind of work-around shell scripts in the entrypoint* for some containers in the vnf-asterisk project that Leif and I have been working on. And that's not perfect when we can use Kubernetes jobs, or in their new parlance, "run to completion finite workloads" (I'll stick to calling them "jobs"). They're one-shot containers that do one thing, and then end (sort of like a "oneshot" of systemd units, at least how we'll use them today). I like the idea of using them to complete some service discovery for me when other pods are coming up. Today we'll fire up a pod, and spin up a job to discover that pod (by querying the API for info about it), and put info into etcd. Let's get the job done.

This post also exists as a [gist on github](https

@StevenACoffman
StevenACoffman / FAAS.md
Last active January 18, 2018 15:06
FAAS
@StevenACoffman
StevenACoffman / *state-machine-component.md
Created September 19, 2017 15:24 — forked from developit/*state-machine-component.md
265b lib for building pure functional state machine components. https://npm.im/state-machine-component

state-machine-component

A tiny (265 byte) utility to create state machine components using two pure functions.

🔥 JSFiddle Demo

Usage

The API is a single function that accepts 2 pure functions as arguments:

@StevenACoffman
StevenACoffman / async javascript.md
Last active November 9, 2017 13:09
Async Await in 7 seconds

Async / Await in 7 seconds

by Wassim Chegham (@manekinekko)

From this awesome animation, originally from this tweet

Callbacks (continuation passing style)

getData( a => {
	getMoreData(a, b => {
Q: My structured log messages contain a field (destinations) that described one or more kafka topics that the messages should be produced to.
Is there a recommended way (or plugin) to fan-out to multiple destinations?
A: use record_reformer to add field to tag, then use tag routing system
Q: How do you split an array (comma separated list) when you don't know how many items will be in it?
A: If you parse such array value in input phase, `types` parameter may help. https://docs.fluentd.org/v0.12/articles/parser_regexp#types
Q: Can the topic key be a comma separated list of topics so that it produces to multiple topics?
https://github.com/fluent/fluent-plugin-kafka
You can use the tag as topic to create multiple topics per data stream
@StevenACoffman
StevenACoffman / Docker Best Practices.md
Last active July 16, 2025 13:09
Docker Best Practices

Mistakes to Avoid: Docker Antipatterns

Whichever route you take to implementing containers, you’ll want to steer clear of common pitfalls that can undermine the efficiency of your Docker stack.

Don’t run too many processes inside a single container

The beauty of containers—and an advantage of containers over virtual machines—is that it is easy to make multiple containers interact with one another in order to compose a complete application. There is no need to run a full application inside a single container. Instead, break your application down as much as possible into discrete services, and distribute services across multiple containers. This maximizes flexibility and reliability.

Don’t install operating systems inside Docker containers

It is possible to install a complete Linux operating system inside a container. In most cases, however, this is not necessary. If your goal is to host just a single application or part of an application in the container, you need to install only the essential