-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathapp-deployment.yaml
69 lines (65 loc) · 3.09 KB
/
app-deployment.yaml
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
59
60
61
62
63
64
65
66
67
68
69
apiVersion: apps/v1
kind: Deployment # mentions this is a Deployment
metadata:
name: go-app # name of Deployment
spec:
replicas: 2 # creates 2 replicated Pods
selector:
matchLabels:
app: go-app # defines how the Deployment finds which Pods to manage
template:
metadata:
labels:
app: go-app # specifies that the Pods are to be named as go-app
spec: # specification for each Pod .This block indicates that the Pods run one container 'go-app-container', which runs the jeshocarmel/ip_location_mapper dockerhub image .
containers:
- name: go-app-container # name of the container running inside the Pod
image: jeshocarmel/ip_location_mapper # image to deployed in the container
imagePullPolicy: Always # pull image from the repository (dockerhub) always
ports:
- containerPort: 8080 # run on port 8080
livenessProbe: # To check the health of the Pod
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 5
periodSeconds: 15
timeoutSeconds: 5
readinessProbe: # To check if the Pod is ready to serve traffic or not
httpGet:
path: /readiness
port: 8080
scheme: HTTP
initialDelaySeconds: 5
timeoutSeconds: 1
env: # list of env variables passed to the app
- name: IPSTACK_API_KEY # IPSTACK_API_KEY is used inside the app
valueFrom:
secretKeyRef:
name: app-secret # name of the secret
key: apikey # import the value of 'apikey' from app-secret
- name: REDIS_URL # REDIS_URL is the hostname for the redis cluster
valueFrom:
configMapKeyRef:
name: app-configmap # name of the config-map
key: redis-service # import the value of 'redis-service' from app-configmap
- name: REDIS_PASSWORD # REDIS_PASSWORD is used by the app to authenticate with the redis host
valueFrom:
secretKeyRef:
name: app-secret # name of the secret
key: redis-password # import the value of 'redis-password' from app-secret
---
kind: Service # mentions this is a service
apiVersion: v1
metadata:
name: go-app-service # name of service
spec:
type: NodePort # service type to be NodePort
ports:
- name: http
port: 80 # serve on port 80
targetPort: 8080 # reach to port 8080 of all the Pods in the selector block
nodePort: 30000 # use port 30000 as nodePort
selector:
app: go-app # The set of Pods with name'go-app' is targeted by this Service