Hello! I’m running an ubuntu container on k3s and...
# k3s
g
Hello! I’m running an ubuntu container on k3s and trying to reach an IP address outside of k3s, running on loalhost. On minikube (on Docker) I find the IP from the URL for
host.docker.internal
+ a port (usually something like 192.168.65.2:PORT_NUM). Thats not working on k3s, so what should ip address should I use?
Any advice on this? I’m stumped.
n
Its because minikube on docker has access to the docker network. For K3s you're operating in regular K8s world. There are several options, most typical is use the Service + Endpoints combo to access whatever it is your trying to reach
Copy code
apiVersion: v1
kind: Service
metadata:
  name: host-service
spec:
  ports:
    - port: XXXX # The port inside the pod to call
---
apiVersion: v1
kind: Endpoints
metadata:
  name: host-service
subsets:
  - addresses:
      - ip: X.X.X.X # host LAN IP
    ports:
      - port: XXXX # The port the service is using on the host
g
Ouch. I wanted to be sure I could reach the host network manually before setting up a service…
Thanks!
g
you can probably use port-forward