I have created python app following this link https://kubernetes.io/blog/2019/07/23/get-started-with-kubernetes-using-python/. I want to configure AWS ALB Ingress Controller/nginx controller
and ingress resource
but I am unable to understand the file. I don't have a domain using Kops on ec2-instance, want to configure it without any domain. Any help would be appreciated.
deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-python
spec:
selector:
matchLabels:
app: hello-python
template:
metadata:
labels:
app: hello-python
spec:
containers:
- name: hello-python
image: hello-python:latest
ports:
- containerPort: 5000
service
apiVersion: v1
kind: Service
metadata:
name: hello-python-service
spec:
selector:
app: hello-python
type: NodePort
ports:
- nodePort: 30010
port: 6000
targetPort: 5000
An Ingress binds a Service like
hello-python-service
above to an ALB through the nginx ingress controller.It does so by mapping a virtual host to your service so that nginx knows how to route requests.
example:
would generate a resource of class
Ingress
like the below:issuing a curl request like this:
should get you a response from your hello python app.
This obviously depends on you having the nginx ingress controller deployed and configured in your EKS cluster.
The key takeaway for an ingress is this: It replaces the need for a dedicated service of type LoadBalancer to provide external access to your service. Instead, Ingress maps traffic from outside the cluster to services in the cluster through a virtual host that is configured in the Ingress' manifest file.