Skip to content

Instantly share code, notes, and snippets.

Avatar

Mark Betz Markbnj

View GitHub Profile
@Markbnj
Markbnj / test-deployment.yaml
Created Nov 12, 2017
k8s-networking-services/test-deployment
View test-deployment.yaml
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: service-test
spec:
replicas: 2
selector:
matchLabels:
app: service_test_pod
template:
@Markbnj
Markbnj / check_docker.sh
Created Oct 17, 2015
Check kernel configuration for docker compatibility
View check_docker.sh
curl https://raw.githubusercontent.com/docker/docker/master/contrib/check-config.sh | bash
# yes, I know
@Markbnj
Markbnj / docker-inject-ec2-host-ip.sh
Created Aug 11, 2015
Inject the ec2 instance private IP into a docker container at start
View docker-inject-ec2-host-ip.sh
# Sometimes you need to get the IP of the ec2 instance a container
# is running on. This script will get the IP from the local metadata
# service and inject it as an environment var.
localip=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4)
export HOST_IP=$localip
sudo docker run -i -t -e "HOST_IP=$localip" --name="test" -h="test" some-repo
View test-ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: test-ingress
annotations:
kubernetes.io/ingress.class: "gce"
spec:
tls:
- secretName: my-ssl-secret
rules:
View test-service-loadbalancer.yaml
kind: Service
apiVersion: v1
metadata:
name: service-test
spec:
type: LoadBalancer
selector:
app: service_test_pod
ports:
- port: 80
View test-service-nodeport.yaml
kind: Service
apiVersion: v1
metadata:
name: service-test
spec:
type: NodePort
selector:
app: service_test_pod
ports:
- port: 80
@Markbnj
Markbnj / test-client2-pod.yaml
Last active Nov 14, 2017
k8s-networking-services/test-client2-pod
View test-client2-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: service-test-client2
spec:
restartPolicy: Never
containers:
- name: test-client2
image: alpine
command: ["/bin/sh"]
@Markbnj
Markbnj / test-client1-pod.yaml
Last active Nov 12, 2017
k8s-networking-services/test-client1-pod
View test-client1-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: service-test-client1
spec:
restartPolicy: Never
containers:
- name: test-client1
image: alpine
command: ["/bin/sh"]
@Markbnj
Markbnj / test-service.yaml
Last active Nov 12, 2017
k8s-networking-services/test-service
View test-service.yaml
kind: Service
apiVersion: v1
metadata:
name: service-test
spec:
selector:
app: service_test_pod
ports:
- port: 80
targetPort: http
@Markbnj
Markbnj / geonames-org-wrapper.py
Created Aug 11, 2015
A simple geonames.org wrapper in python
View geonames-org-wrapper.py
import requests
import json
# For information on endpoints and arguments see the geonames
# API documentation at:
#
# http://www.geonames.org/export/web-services.html
class Geonames(object):
You can’t perform that action at this time.