Skip to content

Instantly share code, notes, and snippets.

@Rajpratik71
Created September 15, 2022 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rajpratik71/d624f1ad0fa367098203830704ddbad1 to your computer and use it in GitHub Desktop.
Save Rajpratik71/d624f1ad0fa367098203830704ddbad1 to your computer and use it in GitHub Desktop.
hostNetworkPoc.yaml
apiVersion: v1
kind: Pod
metadata:
name: influxdb
spec:
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: influxdb
image: influxdb
ports:
- containerPort: 8086
hostPort: 8086
---
kind: Service
apiVersion: v1
metadata:
name: influxdb
spec:
type: ClusterIP
ports:
- port: 8086
targetPort: 8086
selector:
name: influxdb
@aojea
Copy link

aojea commented Sep 16, 2022

this manifest is wrong , the selector of the service doesn't match the pod, thus there is no endpoints to forward the traffic.

You have to add a label to the Pod to match the service selector

https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment