Newbernetes hello world pod (sh/http)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: hello-world-pod-2 | |
labels: # You'll use labels A LOT w/ kube | |
app: hello-world # They are useful for organizing and identifying attributes of an object | |
spec: | |
containers: # This spec has multiple containers, how fancy! | |
- name: hello-world-sh | |
image: busybox | |
command: ['sh', '-c', 'while true; do echo "Hello World"; sleep 2; done'] | |
- name: hello-world-http | |
image: busybox | |
command: ['sh','-c', 'echo "hello world" > index.html && /bin/httpd -p 9000 -f'] | |
ports: # A port this container is exposing | |
- containerPort: 9000 | |
protocol: TCP | |
--- | |
kind: Service # Services can expose pods to the public | |
apiVersion: v1 | |
metadata: | |
name: hello-world-svc | |
spec: | |
type: NodePort | |
ports: | |
- port: 80 | |
targetPort: 9000 # The port to target on the container | |
selector: | |
app: hello-world |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment