-
Notifications
You must be signed in to change notification settings - Fork 378
/
k8s-bootcamp-app.yml
38 lines (38 loc) · 935 Bytes
/
k8s-bootcamp-app.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
---
apiVersion: apps/v1 # Note the changes from Pod file
kind: Deployment # Note the change
metadata:
name: k8s-bootcamp-deploy
labels:
app: k8s-bootcamp-app
spec:
replicas: 1 # number of replicas
selector: # selector
matchLabels:
app: k8s-bootcamp # this should match the Pod label in spec
template: # template
metadata:
name: k8s-bootcamp-pod
labels:
app: k8s-bootcamp # Pod label
spec:
containers:
- name: k8s-bootcamp-container
image: gcr.io/google-samples/kubernetes-bootcamp:v1
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: k8s-bootcamp-svc
labels:
app: k8s-bootcamp-app
spec:
type: NodePort # Default is ClusterIP if not specified
selector:
app: k8s-bootcamp # match the Pod label
ports:
- port: 8888
targetPort: 8080 # targetPort is optional if same as port number
protocol: TCP