Skip to content

Instantly share code, notes, and snippets.

@milesich
Created March 1, 2023 10:03
Show Gist options
  • Save milesich/d81298122c56f265e10092a8f02b9fcc to your computer and use it in GitHub Desktop.
Save milesich/d81298122c56f265e10092a8f02b9fcc to your computer and use it in GitHub Desktop.
accessing host machine ports from Kind pods
https://github.com/kubernetes-sigs/kind/issues/1200#issuecomment-1304855791
For those interested I think I came with a simpler solution to route network to the host machine, using headless or ExternalName services. The solution is different for Linux and Mac/Window (the latter using Docker desktop).
Linux solution: headless service + endpoint:
---
apiVersion: v1
kind: Endpoints
metadata:
name: dockerhost
subsets:
- addresses:
- ip: 172.17.0.1 # this is the gateway IP in the "bridge" docker network
---
apiVersion: v1
kind: Service
metadata:
name: dockerhost
spec:
clusterIP: None
Mac/Windows (Docker Desktop) solution: ExternalName service:
---
apiVersion: v1
kind: Service
metadata:
name: dockerhost
spec:
type: ExternalName
externalName: host.docker.internal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment