apiVersion: v1
kind: Pod
metadata:
labels:
app: httpd
version: v1
name: httpd-v1
namespace: default
spec:
containers:
- image: httpd
name: httpd
resources: {}
volumeMounts:
- mountPath: /usr/local/apache2/htdocs
name: index-html
dnsPolicy: ClusterFirst
initContainers:
- command:
- sh
- -c
- mkdir /usr/local/apache2/htdocs;( echo '<html> <body> <h1>This is version V1!</h1>
</body></html>' ) > /usr/local/apache2/htdocs/index.html
image: busybox
name: busybox
volumeMounts:
- mountPath: /usr/local/apache2/htdocs
name: index-html
restartPolicy: Always
volumes:
- emptyDir: {}
name: index-html
---
apiVersion: v1
kind: Service
metadata:
labels:
app: web-service
name: web-service
spec:
ports:
- name: http-port
port: 80
protocol: TCP
targetPort: 80
selector:
app: httpd
type: ClusterIP