-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.yml
39 lines (39 loc) · 1.37 KB
/
deploy.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
---
# Define a Deployment resource for the web application
kind: Deployment
apiVersion: apps/v1 # apiVersion
metadata:
name: web-app # Name of the deployment
namespace: default # Namespace in which the deployment is created
labels:
app: web-app # Labels to identify the deployment
spec:
replicas: 2 # Number of pod replicas to run
selector:
matchLabels:
app: web-app # Selector to identify pods managed by this deployment
template:
metadata:
labels:
app: web-app # Labels assigned to the pods created by this deployment
spec:
containers:
- name: web-app # Name of the container
image: "alilotfi/jenkins-k8s:latest" # Docker image to use for the container
ports:
- containerPort: 8585 # Port on which the container listens for traffic
---
# Define a Service resource to expose the web application
apiVersion: v1
kind: Service
metadata:
name: web-app # Name of the service
namespace: default # Namespace in which the service is created
spec:
selector:
app: web-app # Selector to route traffic to the pods with this label
type: LoadBalancer # Type of service; LoadBalancer exposes it externally
ports:
- name: http # Name of the port configuration
targetPort: 8585 # Port on the pod to forward traffic to
port: 80 # Port exposed by the service