Reputation: 42604
I deployed a nginx container to EKS cluster. it includes a ALB ingress controller and I am able to see the ALB is created and its rule is also created. But when I click the rule to open the target group, I see there is empty under Target
tab which means the route doesn't route any traffic to nginx container.
I am able to see the pod (sidecar-app-6889d46d46-bns46
) is running:
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
sample-es-74db8bcd65-2sq5v 1/1 Running 0 4h40m
sidecar-app-6889d46d46-bns46 1/1 Running 0 4h42m
The service is also look good to me:
$ kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.100.0.1 <none> 443/TCP 4d5h
sample-es-entrypoint NodePort 10.100.57.164 <none> 9200:31987/TCP 4h41m
sidecar-entrypoint NodePort 10.100.164.72 <none> 80:31144/TCP 4h43m
So what is the reason that the target is not created?
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-conf
data:
nginx.conf: |
user nginx;
worker_processes 1;
events {
worker_connections 10240;
}
http {
server {
listen 80;
server_name localhost;
location /* {
proxy_pass http://localhost:9200/;
}
}
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: sidecar-app
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- name: http
containerPort: 80
volumeMounts:
- name: nginx-conf
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
readOnly: true
volumes:
- name: nginx-conf
configMap:
name: nginx-conf
items:
- key: nginx.conf
path: nginx.conf
---
apiVersion: v1
kind: Service
metadata:
name: sidecar-entrypoint
spec:
selector:
name: sidecar-app
ports:
- port: 80
targetPort: 80
protocol: TCP
type: NodePort
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: sidecar-ingress-1
namespace: default
annotations:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/group.name: sidecar-ingress
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/target-type: ip
alb.ingress.kubernetes.io/group.order: '2'
spec:
rules:
- http:
paths:
- path: /*
backend:
serviceName: sidecar-entrypoint
servicePort: 80
Upvotes: 0
Views: 1283
Reputation: 42604
After did some debugging, the issue is the match label in my configuration is wrong app: nginx
, which should be name: sidecar-app
Upvotes: 1