I have a gatsby application and am using EKS to manage my cluster. Despite sshing into my pod and curling against localhost:3000
and receiving a response, I am unable to hit my load balancer and get a response.
This is what my Dockerfile looks like
FROM node:10
WORKDIR /app
COPY package.json ./
RUN yarn
COPY . .
RUN yarn gatsby:build-staging
EXPOSE 3000
ENV NODE_ENV=development
ENV REACT_APP_STAGE=development
CMD [ "yarn", "serve" ]
This is what my k8s file looks like
apiVersion: v1
kind: Service
metadata:
name: <SOME_NAME>
labels:
app: <SOME_NAME>
annotations:
# Note that the backend talks over HTTP.
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
# TODO: Not comfortable with this being in code - TODO: move this into a circleci environment variable
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: <SSL CERT>
# Only run SSL on the port named "https" below.
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "https"
spec:
type: LoadBalancer
selector:
app: <SOME_NAME>
ports:
- port: 443
targetPort: 3000
protocol: TCP
name: https
- port: 80
targetPort: 3000
protocol: TCP
name: http
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: <SOME_NAME>
labels:
app: <SOME_NAME>
spec:
replicas: 1
selector:
matchLabels:
app: <SOME_NAME>
template:
metadata:
labels:
app: <SOME_NAME>
spec:
containers:
- name: <SOME_NAME>
image: <IMAGE_NAME>
imagePullPolicy: Always
env:
- name: VERSION_INFO
value: "1.0"
- name: BUILD_DATE
value: "1.0"
ports:
- containerPort: 3000
This is what serve
looks like
"gatsby serve -p 3000"
I don't see why I have a problem - when I ssh into the pod and curl against http://localhost:3000
I get a response. Seems like something is wrong with the load balancer.