Closed majst01 closed 4 years ago
My wild guess is we simply need to add a selector like:
apiVersion: v1
kind: Service
spec:
clusterIP: None
ports:
- port: 9630
protocol: TCP
targetPort: nftexporter
sessionAffinity: None
selector:
app: nftexporter
type: ClusterIP
I just tested a curl to the services within the cluster and would not have thought that forwarding those services is possible.
And reading the code of kubefwd, it seems as kubefwd can not forward headless services that don't have pods in the background. kubefwd looks up the pods behind a service and picks one of the podIPs to forward to:
https://github.com/txn2/kubefwd/blob/642fa5e2be7404378e9581ef2a151468337ea31c/pkg/fwdservice/fwdservice.go#L114 https://github.com/txn2/kubefwd/blob/642fa5e2be7404378e9581ef2a151468337ea31c/pkg/fwdservice/fwdservice.go#L52
This is what we could do about it:
I will add a small explanation to the existing documentation howto use these services.
The metrics can be accessed like this from within a cluster:
curl nftables-exporter.firewall.svc.cluster.local:9630/metrics
curl node-exporter.firewall.svc.cluster.local:9100/metrics
added all this to the documentation
same with kubefwd: