-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample_server_service.yml
32 lines (32 loc) · 1.17 KB
/
sample_server_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
# SERVICE DEFINITION
# ===
# Services exposes our pods so we can access them from outside the cluster
# (no tunneling or network dark magic skills required).
---
apiVersion: v1
kind: Service
metadata:
# mind -load-balancer, we'll use this name for the ingress definition later.
name: sample-server-load-balancer
# notice here, we want to use the same "universe" defined in sample-server.yml
namespace: sample-server-ns
# We'll use this later for filtering resources
labels:
target: sample-server
# This is the actual definition of the service
spec:
# service type load balancer is used with cloud providers to get an
# ip/hostname to access the pods. The ingress (later defined) will
# link to this.
type: LoadBalancer
ports:
- name: http
protocol: TCP
port: 8101 # this is the port we want to expose for the service
# funny enough THIS PORT can't be repeated, I learned it afterwards.
# so you have to use unique ports here (at least in my single-node k3s
# server).
targetPort: 8000 # this is the port exposed in the pods.
# Mind here, sample-server-app is the name defined in sample_server_deployment.yml
selector:
app: sample-server-app