Skip to content

Instantly share code, notes, and snippets.

@vmarmol
vmarmol / get_metrics.sh
Created June 3, 2015 17:26
Get performance metrics from local Kubelet
#!/bin/bash
METRICS=`curl localhost:10248/metrics 2> /dev/null`
echo "$METRICS" | grep docker_error
echo "$METRICS" | grep sync_pods
echo "$METRICS" | grep sync_pod
vmarmol@kubernetes-master:~$ sudo ls -R /var/etcd
/var/etcd:
data
/var/etcd/data:
snap wal
/var/etcd/data/snap:
0000000000000516-0000000000222ee0.snap 0000000000000516-000000000022a413.snap
0000000000000516-00000000002255f1.snap 0000000000000516-000000000022cb24.snap
type Config struct {
// Hostname optionally sets the container's
// hostname if provided
Hostname string
// Networks specifies the container's network
// setup to be created
Networks []*Network
// Routes can be specified to create entries
@vmarmol
vmarmol / Dockerfile
Created February 10, 2015 18:04
Certs Error in Containers
FROM ubuntu
ADD secure /secure
ENTRYPOINT ["/secure"]
@vmarmol
vmarmol / client.go
Created February 9, 2015 23:21
Simple Go-based HTTP streaming via HTTP and websockets.
package main
import (
"encoding/json"
"flag"
"io"
"net/http"
"github.com/golang/glog"
"golang.org/x/net/websocket"
package main
import (
"libcontainer"
"os"
)
func startContainer() error {
config, err := loadConfigFromSomewhere()
if err != nil {
@vmarmol
vmarmol / api.go
Last active August 29, 2015 14:04 — forked from crosbymichael/api.go
package main
import (
"libcontainer"
"os"
)
func startContainer() error {
config, err := loadConfigFromSomewhere()
if err != nil {
@vmarmol
vmarmol / reparent.c
Created July 11, 2014 16:26
Reparent Command to Init in Namespace
#include <stdlib.h>
#include <stdio.h>
#include <sched.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main() {
// NOTE: replace <pid> with PID of init, or take as an arg. This was shorter :)
@vmarmol
vmarmol / gist:ec389ac73e92f732aa80
Created June 8, 2014 01:29
Simple Go Webserver
package main
import (
"flag"
"fmt"
"log"
"net/http"
)
var argPort = flag.Int("port", 8080, "port to listen")
@vmarmol
vmarmol / cap_test.go
Last active August 29, 2015 14:01
gocapability ignored EINVAL
package main
import (
"./capability"
"fmt"
"os"
)
// NOTE: Run as root.
func main() {