Skip to content

Instantly share code, notes, and snippets.

@coryodaniel
Last active July 16, 2021 03:07
Show Gist options
  • Save coryodaniel/7d99d514520245c8fbeb7ac180a87d7d to your computer and use it in GitHub Desktop.
Save coryodaniel/7d99d514520245c8fbeb7ac180a87d7d to your computer and use it in GitHub Desktop.
Newbernetes hello world pod (sh/http)
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