How can I get my EKS cluster IP/deployment link to access my applications?
I have deployed a simple web application onto a cluster on Amazon EKS. When I send a GET request to the (/nginx) route, my app responds with the nginx server default message and GET request to (/apache) route responds with it default message of apache server.
My Deployment, Service and Ingress configuration files are as follows:
manifest.yml file
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
namespace: default
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:alpine
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: nginx-service
namespace: default
spec:
selector:
app: nginx
ports:
- protocol: TCP
port: 80
targetPort: 80
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: apache-deployment
namespace: default
spec:
replicas: 2
selector:
matchLabels:
app: apache
template:
metadata:
labels:
app: apache
spec:
containers:
- name: my-apache-site
image: httpd:2.4
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: apache-service
namespace: default
spec:
selector:
app: apache
ports:
- protocol: TCP
port: 80
targetPort: 80
type: ClusterIP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: web-apps-ingress
namespace: default
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: nginx
rules:
- host: your-domain.com
http:
paths:
- path: /nginx
pathType: Prefix
backend:
service:
name: nginx-service
port:
number: 80
- path: /apache
pathType: Prefix
backend:
service:
name: apache-service
port:
number: 80
Note:
I have to update the local hosts entry (/etc/hosts ) such that your-domain.com points to the IP of my load balancer (but I don’t know how to get it)
??.??.??.?? your-domain.com
so, I can access it on your-domain.com instead IP directly (Ingress needs a domain mapping, hence used)
In Vultr the cluster IP is shown, and can be used to access deployed apps.
I have looked on this post stating it needs an ingress, but not a way to access the IP or deployment link.
I have searched through the documentation and Cloud console for the IP/Domain.