-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeployment.yml
36 lines (36 loc) · 1.41 KB
/
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
apiVersion: apps/v1 # For versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata: # Data that helps uniquely identify the object (using name, UID and namespace)
name: angular-k8s-deployment
spec: # What state you desire for the object
selector: # The selector field defines how the deployment finds which pod to manage
matchLabels:
app: angular-k8s-deployment
replicas: 3 # Tells the deployment to run 3 pods matching the template
template:
metadata:
labels: # Labels are used as indentifying attributes for objects such as pods and replication controller.
app: angular-k8s-deployment
spec:
containers:
- name: angular-k8s-deployment
image: angular-app:latest
imagePullPolicy: Never
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: angular-k8s-service
labels:
name: angular-k8s-deployment
spec:
ports:
- nodePort: 30170 # make the service available to network requests from external clients
port: 80 # access the service via external port no
targetPort: 80 # port number that container listening on
protocol: TCP
selector:
app: angular-k8s-deployment
type: NodePort # which expose the application on a port across a each of your nodes