express-cluster-ip-service.yaml
apiVersion: v1
kind: Service
metadata:
name: express-cluster-ip-service
spec:
type: ClusterIP
selector:
component: server
ports:
- port: 5000
targetPort: 5000
express-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: express-deployment
spec:
replicas: 3
selector:
matchLabels:
component: server
template:
metadata:
labels:
component: server
spec:
containers:
- name: express
image: simonjames/react-node-docker-kubernetes-app-express
ports:
- containerPort: 5000
env:
- name: REDIS_HOST
value: redis-cluster-ip-service
- name: REDIS_PORT
value: '6379'
- name: PGUSER
value: postgres
- name: PGHOST
value: postgres-cluster-ip-service
- name: PGPORT
value: '5432'
- name: PGDATABASE
value: postgres
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: pgpassword
key: PGPASSWORD
react-cluster-ip-service.yaml
apiVersion: v1
kind: Service
metadata:
name: react-cluster-ip-service
spec:
type: ClusterIP
selector:
component: web
ports:
- port: 3000
targetPort: 3000
react-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: react-deployment
spec:
replicas: 3
selector:
matchLabels:
component: web
template:
metadata:
labels:
component: web
spec:
containers:
- name: react
image: simonjames/react-node-docker-kubernetes-app-react
ports:
- containerPort: 3000
ingres-service.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress-service
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
rules:
- http:
paths:
- path: /?(.*)
backend:
serviceName: react-cluster-ip-service
servicePort: 3000
- path: /api/?(.*)
backend:
serviceName: express-cluster-ip-service
servicePort: 5000
I am getting a 503 error when I browse the url mapped to my minikube. What may be causing this? Is there any issue with the config. It ran fine when I used docker-compose.yaml. I am using similar configs, so what is the issue here?
Best Answer
A 503 Service Unavailable Error is an
HTTP response status code
indicating that a server is temporarily unable to handle the request. This may be due to the server being overloaded or down for maintenance.I performed a test with your deployment yamls but used a different images since I don`t have access to the one that you mention and it all works fine for me. Ingress and services are correctly sending traffic to appropriate pods. If I remove one once of the services I get exact the same error when trying to reach it.
This indicates that this is
server connectivity issue
and traffic cannot reach your pods due to some configuration, port mismatch or that somewhere in the chain server is down or unreachable.I suggest you to first check your connectivity with different images and confirm the same results as mine. As second check you may want to look into
nginx controller pod
: