-
Notifications
You must be signed in to change notification settings - Fork 1
/
back-deployment.yml
48 lines (48 loc) · 1.79 KB
/
back-deployment.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
apiVersion: apps/v1 # API version
kind: Deployment # Type of kubernetes resource
metadata:
name: back # Name of the kubernetes resource
labels: # Labels that will be applied to this resource
app: back
spec:
replicas: 2 # No. of replicas/pods to run in this deployment
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 0
maxUnavailable: 1
selector:
matchLabels: # The deployment applies to any pods mayching the specified labels
app: back
template: # Template for creating the pods in this deployment
metadata:
labels: # Labels that will be applied to each Pod in this deployment
app: back
spec: # Spec for the containers that will be run in the Pods
containers:
- name: back
image: index.docker.io/mz77/mzfood:back
imagePullPolicy: Always
ports:
- name: http
containerPort: 8080 # The port that the container exposes
resources:
limits:
cpu: 0.2
memory: "200Mi"
---
apiVersion: v1 # API version
kind: Service # Type of the kubernetes resource
metadata:
name: back # Name of the kubernetes resource
labels: # Labels that will be applied to this resource
app: back
spec:
type: NodePort # The service will be exposed by opening a Port on each node and proxying it.
selector:
app: back # The service exposes Pods with label `app=back`
ports: # Forward incoming connections on port 8080 to the target port 8080
- name: http
port: 8080
nodePort: 31001
targetPort: 8080