Skip to content

Instantly share code, notes, and snippets.

View hjacobs's full-sized avatar
🇩🇪

Henning Jacobs hjacobs

🇩🇪
View GitHub Profile
apiVersion: v1
items:
- apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"apiextensions.k8s.io/v1beta1","kind":"CustomResourceDefinition","metadata":{"annotations":{},"name":"awsiamroles.zalando.org"},"spec":{"additionalPrinterColumns":[{"JSONPath":".status.roleARN","description":"Full RoleARN","name":"RoleARN","type":"string"},{"JSONPath":".status.expiration","description":"Expiration time of the current credentials provisioned for the role","name":"Expiration","type":"string"}],"group":"zalando.org","names":{"categories":["all"],"kind":"AWSIAMRole","plural":"awsiamroles","singular":"awsiamrole"},"scope":"Namespaced","subresources":{"status":{}},"validation":{"openAPIV3Schema":{"properties":{"spec":{"properties":{"roleReference":{"description":"Reference to an AWS IAM role which can either be a role name\nor a full IAM role ARN.\n","minLength":3,"type":"string"},"roleSessionDu
@hjacobs
hjacobs / zmon-kubernetes-pod-container-metrics.py
Created May 16, 2019 09:44
ZMON Kubernetes Pod Container Metrics
def check():
prometheus_url = "http://prometheus.kube-system.svc.cluster.local./api/v1/query"
metrics = {"_use_scheduled_time": True}
try:
container_selector = """{{container_name="{container_name}", pod_name="{pod_name}", namespace="{pod_namespace}"}}""".format(**entity)
def request_prometheus_metric(query):
params={"query": query.format(container_selector=container_selector)}
@hjacobs
hjacobs / kind-metrics-server.yaml
Created March 31, 2019 09:22
Metrics Server API deployment manifests for Kubernetes kind
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: system:aggregated-metrics-reader
labels:
rbac.authorization.k8s.io/aggregate-to-view: "true"
rbac.authorization.k8s.io/aggregate-to-edit: "true"
rbac.authorization.k8s.io/aggregate-to-admin: "true"
rules:
- apiGroups: ["metrics.k8s.io"]
@hjacobs
hjacobs / bash2html.py
Created October 26, 2017 20:22
Convert bash script to syntax highlighted HTML
#!/usr/bin/env python3
import sys
from pygments import highlight
from pygments.lexers import BashLexer
from pygments.formatters import HtmlFormatter
print(highlight(sys.stdin.read(), BashLexer(), HtmlFormatter(full=True)))
@hjacobs
hjacobs / kubernetes-on-aws-users.md
Last active April 11, 2017 18:23
Companies/Organizations using Kubernetes on AWS
@hjacobs
hjacobs / add-my-ssh-key.yaml
Created January 13, 2017 08:36
Add SSH key to CoreOS authorized_keys via Kubernetes host access
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: add-my-ssh-key
labels:
application: add-my-ssh-key
spec:
template:
metadata:
name: add-my-ssh-key
@hjacobs
hjacobs / pod-host-access.yaml
Created January 13, 2017 08:15
Kubernetes Host Access
apiVersion: v1
kind: Pod
metadata:
name: host-access
spec:
# use a node selector matching the desired target node
nodeSelector:
kubernetes.io/hostname: ip-172-31-1-2.eu-central-1.compute.internal
containers:
- name: shell

Keybase proof

I hereby claim:

  • I am hjacobs on github.
  • I am hjacobs (https://keybase.io/hjacobs) on keybase.
  • I have a public key whose fingerprint is C61A 9A6B 3532 1EAA 6105 75F3 AD86 9A6F 43D8 0A3B

To claim this, I am signing this object: