Im new to kubernetes, sorry in advance for any dumb questions. Im running a small k8s cluster on digital ocean. I create 2 deployment and 2 services, basically identical, with the yaml files below. I then log in to digital ocean load balancer dashboard. I change port 80 to http, and 443 to https with a letsencrypt cert for each load balancer (this creates the A records in the DO DNS). I also enable redirect http to https. (I've tried using annotations to add these settings but the service never starts... might have to make a separate issue for that?)
This works fine with 1 replica. And I can access the app. But if I increase the replicas to 2 or more, I get a 504 when accessing the web containers. Im not really sure where to get logs to see whats going wrong. Any advice would help alot.
apiVersion: v1
kind: Service
metadata:
name: web
spec:
ports:
- name: http
protocol: TCP
port: 80
targetPort: 7767
- name: https
protocol: TCP
port: 443
targetPort: 7767
selector:
app: web
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
spec:
replicas: 3
selector:
matchLabels:
app: web
template:
metadata:
labels:
app: web
spec:
containers:
image: registry.digitalocean.com/myreg/web
imagePullPolicy: "Always"
name: web
ports:
- containerPort: 7767
restartPolicy: Always
imagePullSecrets:
- name: registry-secret
apiVersion: v1
kind: Service
metadata:
name: turn
spec:
ports:
- name: http
protocol: TCP
port: 80
targetPort: 7768
- name: https
protocol: TCP
port: 443
targetPort: 7768
selector:
app: turn
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: turn
spec:
replicas: 3
selector:
matchLabels:
app: turn
template:
metadata:
labels:
app: turn
spec:
containers:
image: registry.digitalocean.com/myreg/turn
imagePullPolicy: "Always"
name: turn
ports:
- containerPort: 7768
restartPolicy: Always
imagePullSecrets:
- name: registry-secret