I am trying to host a simple website using Kubernetes. I am trying to use a K8s deployment, service and an ingress to route the traffic from the external into the application running inside the pod.
The below is my YAML configuration file.
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: trojanwall-deployment
namespace: dev
labels:
app: trojanwall
spec:
replicas: 1
selector:
matchLabels:
app: trojanwall
template:
metadata:
labels:
app: trojanwall
spec:
containers:
- name: trojanwall
image: arbabu/trojan-wall:v1
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: trojanwall-service
namespace: dev
spec:
selector:
app: trojanwall
ports:
- name: http
protocol: TCP
port: 3000
targetPort: 80
type: ClusterIP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: trojanwall-ingress
namespace: dev
spec:
rules:
- host: "ec2-3-96-217-161.compute-1.amazonaws.com"
http:
paths:
- path: "/trojanwall"
pathType: Prefix
backend:
service:
name: trojanwall-service
port:
number: 3000
The following is the resource status.
The expectation is that, when I run something like 'http://ec2-3-96-217-161.compute-1.amazonaws.com/trojanwall', I should be able to access my website. However, I am getting the following.
Does anyone know how to configure the ingress traffic properly?