Skip to content

Instantly share code, notes, and snippets.

View kelseyhightower's full-sized avatar

Kelsey Hightower kelseyhightower

View GitHub Profile

Creating and Scheduling a Pod Manually

This tutorial demonstrates how to create a Pod and manually schedule it to a node using cURL. This guide assumes you don't have a scheduler running in your Kubernetes cluster.

Create a Pod

The following pod will run version 1.10.0 of nginx with a 100m CPU limit.

Create the nginx pod manifest and name it pod.json:

gcloud compute instance-groups unmanaged create taiwan \
--zone asia-east1-a
gcloud compute instance-groups unmanaged add-instances taiwan \
--instances $(kubectl get nodes \
--context taiwan \
--output=jsonpath='{range .items[*]}{.metadata.name},{end}') \
--zone asia-east1-a
gcloud compute instance-groups set-named-ports taiwan \
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: vault-tokenreview-binding
namespace: default
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:auth-delegator
subjects:
kind: Service
apiVersion: v1
metadata:
name: "nginx"
spec:
selector:
app: "nginx"
ports:
- protocol: "TCP"
port: 80

A Gopher Rising

Inspired by Maya Angelou's Still I Rise

You may walk through my GitHub history,
With it’s non idiomatic and fragal lines,
You may value me less than dirt,
But still, like dust, I’ll rise.
INFO: 2020/06/10 09:16:26 [xds-bootstrap] Got bootstrap file location from GRPC_XDS_BOOTSTRAP environment variable: xds-bootstrap.json
INFO: 2020/06/10 09:16:26 [xds-bootstrap] Bootstrap content: {
"xds_servers": [
{
"server_uri": "trafficdirector.googleapis.com:443",
"channel_creds": [
{
"type": "google_default"
}
]
#!/bin/bash
CLUSTERS=$(gcloud container clusters list \
--format 'value(name)[terminator=" "]')
NODE_PORT=32080
gcloud compute health-checks create tcp hello-kubernetes-health-check --port ${NODE_PORT}
gcloud compute backend-services create hello-kubernetes-backend-services \
--connection-draining-timeout 3600 \
// Compile with:
// GOOS=linux go build -a --ldflags '-extldflags "-static"' -tags netgo -installsuffix netgo -o dns-example main.go
//
// Run on Kubernetes. Example resolv.conf
//
// # /etc/reslov.conf
// search default.svc.cluster.local svc.cluster.local cluster.local google.internal c.hightowerlabs.internal
// nameserver 10.179.240.10
// options ndots:5
//
apiVersion: v1
kind: Service
metadata:
labels:
app: helloworld-uwsgi
name: helloworld-uwsgi
spec:
ports:
- port: 80
protocol: TCP
static_resources:
listeners:
- name: health_check_listener
address:
socket_address:
address: 0.0.0.0
port_value: 80
filter_chains:
- filters:
- name: envoy.http_connection_manager