Reputation: 1962
I'm having a small issue that's been taking so much time without luck.
I have an EKS cluster where I created 2 deployments each with it's own service.
My 2 apps are a tensorflow server and a flask app which runs queries on the tf server using the IP of the service dedicated to it.
Now I want to access the Flask app running on one of the 2 from the outside world. So I created an Ingress but it shows with no address at all when I try "kubectl get ingress".
NAME HOSTS ADDRESS PORTS AGE
nlp-ingress * 80 4h5m
I have also noticed the following in the logs of the Flask container
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: 343-385-569
192.168.14.156 - - [16/Jul/2020 17:13:24] code 400, message Bad request syntax ('\x16\x03\x01\x00{\x01\x00\x00w\x03\x03')
192.168.14.156 - - [16/Jul/2020 17:13:24] "[35m[1m\00{\00\00w[0m" HTTPStatus.BAD_REQUEST -
192.168.14.156 - - [16/Jul/2020 17:13:24] "[37mGET / HTTP/1.1[0m" 200 -
192.168.14.156 - - [16/Jul/2020 17:13:24] "[37mGET / HTTP/1.1[0m" 200 -
My ingress yaml file is the following:
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: nlp-ingress
spec:
backend:
serviceName: nlp-client-service
servicePort: 5000
The yaml of my Flask deployment and service:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nlp-client-deployment
spec:
replicas: 1
selector:
matchLabels:
app: nlp-client
template:
metadata:
labels:
app: nlp-client
spec:
containers:
- name: nlp-client-container
image: myimage:latest
command:
- "python"
- "main.py"
- "--server"
- "nlp-server-service:8501"
ports:
- containerPort: 5000
---
apiVersion: v1
kind: Service
metadata:
labels:
run: nlp-client-service
name: nlp-client-service
spec:
ports:
- port: 5000
targetPort: 5000
selector:
app: nlp-client
type: LoadBalancer
My aim is to test my cluster during development.
Any help is greatly appreciated.
Upvotes: 5
Views: 2661
Reputation: 61661
For the ingress to work 💻, you need an ingress controller like one of these. The most common one is the Nginx ingress controller.
Now if you are running both applications on the same cluster, you don't even need an Ingress on your TF server 🙅, a plain Service on port 5000
would do, assuming that's the port where your TF server is listening on.
If you still want to use an Ingress you can still use it but the path would be kind of odd, meaning the request will how out of the cluster and then back into the cluster. 🖖
Upvotes: 2