Skip to content

Instantly share code, notes, and snippets.

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: kube-controller-manager
namespace: {{ CLUSTER_NAME }}
spec:
replicas: 1
template:
spec:
containers:
@guangyouyu
guangyouyu / goroutine-detail
Last active May 1, 2018 21:35
thread apply all bt
(gdb) goroutine 17 bt
#0 runtime.goexit () at /opt/go/src/runtime/asm_amd64.s:2198
#1 0x0000000000000000 in ?? ()
(gdb) goroutine 2 bt
#0 runtime.gopark (unlockf={void (struct runtime.g *, void *, bool *)} 0xc42004e768, lock=0x543d510 <runtime.forcegc>,
reason="force gc (idle)", traceEv=20 '\024', traceskip=1) at /opt/go/src/runtime/proc.go:272
#1 0x000000000042f1be in runtime.goparkunlock (lock=0x543d510 <runtime.forcegc>, reason="force gc (idle)", traceEv=20 '\024',
traceskip=1) at /opt/go/src/runtime/proc.go:277
#2 0x000000000042eede in runtime.forcegchelper () at /opt/go/src/runtime/proc.go:226
#3 0x000000000045c531 in runtime.goexit () at /opt/go/src/runtime/asm_amd64.s:2197
@guangyouyu
guangyouyu / stress-k8s.py
Created May 2, 2018 08:08
stress-k8s.py
from kubernetes import client, config
import time
deployment_name = 'ddd'
def scale_deployment(api_instance, namespace, name, replicas, scale):
scale.spec.replicas = replicas
result = api_instance.patch_namespaced_deployment(namespace='default', name=name, body=scale)
def read_deployment_available(api_instance, namespace, name):