-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx-deployment-and-service.yml
58 lines (57 loc) · 1.4 KB
/
nginx-deployment-and-service.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# api used for deployment
apiVersion: apps/v1
# pod - service what kind of serivce/object
kind: Deployment
# case insensitive metadata
metadata:
# name of deployment
name: nginx-deployment
# specifications for deployment
spec:
selector:
matchLabels:
# looks for label & match with k8 services
app: nginx
# creates 3 replicas (pods) of this set with pods/instances
replicas: 3
# template to use its label for k8 service to launch
template:
metadata:
# label
labels:
# label connects to service or any other k8 components
app: nginx
# define container specifications
spec:
containers:
- name: nginx
image: eslabbert/tech230-nginx:latest
ports:
# exposes this port
- containerPort: 80
---
# select type of API version
apiVersion: v1
# type of service/object
kind: Service
# metadata for name
metadata:
# name of service
name: nginx-svc
# sre - keep private for each team, but as not in production use default
namespace: default
# specification to include ports selector to connect to the
spec:
# port mapping
ports:
# range 30000-32768
- nodePort: 30001
port: 80
targetPort: 80
# define selector and label to connect nginx deployment
selector:
# label connect to nginx deployment
app: nginx
# create NodePort type of deployment
# load balancer for local cluster
type: NodePort