Skip to content

Instantly share code, notes, and snippets.

@iamlittle
Created September 16, 2018 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamlittle/b9512f97824188fa98eb34331efb03d0 to your computer and use it in GitHub Desktop.
Save iamlittle/b9512f97824188fa98eb34331efb03d0 to your computer and use it in GitHub Desktop.
apiVersion: v1
kind: ConfigMap
metadata:
name: httpdconf
data:
index1-html: <html><body><h1>This is server 1</h1></body></html>
index2-html: <html><body><h1>This is server 2</h1></body></html>
index3-html: <html><body><h1>This is server 3</h1></body></html>
---
apiVersion: v1
kind: Service
metadata:
name: apache
spec:
ports:
- port: 8080
targetPort: 80
protocol: TCP
name: primary
selector:
app: apache
---
apiVersion: v1
kind: Pod
metadata:
name: bash
spec:
containers:
- name: bash
image: bash
command: ['sleep', '3600']
---
apiVersion: v1
kind: Pod
metadata:
name: apache1
labels:
app: apache
spec:
containers:
- name: apache
image: httpd
ports:
- containerPort: 80
volumeMounts:
- name: httpdconf
mountPath: /usr/local/apache2/htdocs
volumes:
- name: httpdconf
configMap:
name: httpdconf
items:
- key: index1-html
path: index.html
---
apiVersion: v1
kind: Pod
metadata:
name: apache2
labels:
app: apache
spec:
containers:
- name: apache
image: httpd
ports:
- containerPort: 80
volumeMounts:
- name: httpdconf
mountPath: /usr/local/apache2/htdocs
volumes:
- name: httpdconf
configMap:
name: httpdconf
items:
- key: index2-html
path: index.html
---
apiVersion: v1
kind: Pod
metadata:
name: apache3
labels:
app: apache
spec:
containers:
- name: apache
image: httpd
ports:
- containerPort: 80
volumeMounts:
- name: httpdconf
mountPath: /usr/local/apache2/htdocs
volumes:
- name: httpdconf
configMap:
name: httpdconf
items:
- key: index3-html
path: index.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment