Skip to content

Instantly share code, notes, and snippets.

@robrich
Created February 4, 2020 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save robrich/908b06c9d04b50b938219b92207f3d65 to your computer and use it in GitHub Desktop.
Save robrich/908b06c9d04b50b938219b92207f3d65 to your computer and use it in GitHub Desktop.
Kubernetes first elements
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp
labels:
app: myapp
spec:
replicas: 3
template:
metadata:
labels:
app: myapp
spec:
containers:
- name: nginx
image: nginx:1.17.8
ports:
- containerPort: 80
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: myapp
annotations:
# cloud-specific annotations may be necessary
spec:
rules:
- host: my.example.com
http:
paths:
- path: /
backend:
serviceName: myapp
servicePort: 80
apiVersion: v1
kind: Pod
metadata:
name: myapp
labels:
app: myapp
spec:
containers:
- name: nginx
image: nginx:1.17.8
ports:
- containerPort: 80
apiVersion: v1
kind: Service
metadata:
name: myapp
labels:
app: myapp
spec:
selector:
app: myapp
type: NodePort
ports:
- port: 80
targetPort: 80
protocol: TCP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment