apiVersion: apps/v1 kind: Deployment metadata: name: sleep labels: kiamol: ch07 spec: selector: matchLabels: app: sleep template: metadata: labels: app: sleep spec: initContainers: - name: init-html image: kiamol/ch03-sleep command: ['sh', '-c', "echo '

KIAMOL Ch07

' > /data/index.html"] volumeMounts: - name: data mountPath: /data containers: - name: sleep image: kiamol/ch03-sleep - name: server image: kiamol/ch03-sleep command: ['sh', '-c', 'while true; do echo -e "HTTP/1.1 200 OK\nContent-Type: text/html\nContent-Length: 62\n\n$(cat /data-ro/index.html)" | nc -l -p 8080; done'] ports: - containerPort: 8080 name: http volumeMounts: - name: data mountPath: /data-ro readOnly: true volumes: - name: data emptyDir: {}