Skip to content

Instantly share code, notes, and snippets.

@coryodaniel
Last active July 16, 2021 03:07
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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