Skip to content

Instantly share code, notes, and snippets.

@dmaze
Created January 17, 2018 01:45
Show Gist options
  • Save dmaze/7d2a0b3b8fc45d6a146b13d3aa68f7f6 to your computer and use it in GitHub Desktop.
Save dmaze/7d2a0b3b8fc45d6a146b13d3aa68f7f6 to your computer and use it in GitHub Desktop.
Very minimal Kubernetes NodePort/LoadBalancer services
---
apiVersion: v1
kind: ConfigMap
metadata: {name: content}
data:
index.html: '<html><body><h1>Hello world</h1></body></html>'
---
apiVersion: apps/v1beta2
kind: Deployment
metadata: {name: lb}
spec:
selector: {matchLabels: {name: lb}}
template:
metadata: {labels: {name: lb}}
spec:
volumes:
- name: content
configMap: {name: content}
containers:
- name: httpd
image: busybox
args: [httpd, -f, -v, -p, '8111', -h, /content]
volumeMounts:
- name: content
mountPath: /content
ports:
- name: http
containerPort: 8111
---
apiVersion: v1
kind: Service
metadata: {name: lb}
spec:
selector: {name: lb}
type: LoadBalancer
ports:
- name: http
port: 8181
targetPort: http
---
apiVersion: apps/v1beta2
kind: Deployment
metadata: {name: np}
spec:
selector: {matchLabels: {name: np}}
template:
metadata: {labels: {name: np}}
spec:
volumes:
- name: content
configMap: {name: content}
containers:
- name: httpd
image: busybox
args: [httpd, -f, -v, -p, '8222', -h, /content]
volumeMounts:
- name: content
mountPath: /content
ports:
- name: http
containerPort: 8222
---
apiVersion: v1
kind: Service
metadata: {name: np}
spec:
selector: {name: np}
type: NodePort
ports:
- name: http
port: 8282
targetPort: http
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment