I want a created Service per pod to be used from a dynamically generated Ingress.
But for that, I need a way to differentiate pods instantiated by my DaemonSet.
I tried:
apiVersion: v1
kind: Service
metadata:
name: my-service-node1
spec:
selector:
app: my-app
kubernetes.io/hostname: "node1"
ports:
- protocol: TCP
port: 80
targetPort: 80
but kubernetes.io/hostname
is only defined in node,
I look for a way to forward this label, and I find this only Q/A.
Generating a random label for each DaemonSet should work too, but I think it is not possible too.
Using variables in my template/metadata/labels
in my DaemonSet
would be nice, but that does not exist too.
If I could refer a pod directly in my Ingress, that would fix my problem, but it look like an Ingress can only talk to a Service.
I published a Docker image that takes care of this issue.
the image is here.
the code source is here
Check the doc on docker hub
update: A full usage sample is available here:
can be test with:
kubectrl apply -f https://raw.githubusercontent.com/UrielCh/dyn-ingress/main/demo.yml