Created
March 1, 2023 10:03
-
-
Save milesich/d81298122c56f265e10092a8f02b9fcc to your computer and use it in GitHub Desktop.
accessing host machine ports from Kind pods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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