简体   繁体   中英

Is it posible set a external IP at 192.168.1.X/24 in a kubernetes service?

I have a kube.netes cluster located in 192.168.1.130. When I deploy services, those services are reachable from the cluster, but not from the rest of the devices in the.network.

I have thought that one solution could be set a external IP at 192.168.1.X/24. Is it posible?

Deploy nginx ingress controller, then setup an ingress object to port 80, if you are running k8s in your notebook or pc without a vm, then the service should be able to be reached from any device in the same.network with http://your-ip:80

Example ingress:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
spec:
  rules:
    - http:
        paths:
          - path: /*
            backend:
              service:
                name: your_service
                port:
                  number: 8080 #YourServicePort

Then all your requests will be forwarded to your_service:yourport

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM