admin管理员组

文章数量:1122846

I have a K3S cluster that runs nodes on 192.168.0.100-110 on a Raspberry Pi as a fun demo. I create a Deployment which has a Service of: app:3000 to access a webpage. I want to create a new IP on the host network that proxies to: app:3000. I was trying to set ExternalIp, and while it says I have an external ip of 192.168.0.99 with a port of 80, then I try to browse to it, it times out.

App Service:

apiVersion: v1
kind: Service
metadata:
  name: grafana
  namespace: monitoring
  annotations:
      prometheus.io/scrape: 'true'
      prometheus.io/port:   '3000'
spec:
  selector: 
    app: grafana
  type: NodePort
  externalIPs: ["192.168.0.99"]  
  ports:
    - port: 3000
      targetPort: 3000
      nodePort: 32000

kubectl get services -o wide

NAME                 TYPE       CLUSTER-IP    EXTERNAL-IP    PORT(S)          AGE   SELECTOR
grafana              NodePort   10.43.98.95   192.168.0.99   3000:32000/TCP   47h   app=grafana
prometheus-service   NodePort   10.43.8.85    <none>         8080:30000/TCP   2d    app=prometheus-server

Before I set the port to 80, i wanted to see if i can browse to this ip as it exists, and it will time out when accessing: 192.168.0.99:3000 and 192.168.0.99:32000.

I am thinking I am doing something wrong, but i cant quite tell. I was thinking that an issue with k3s is that it doesnt have proper way to set External IP on the host network something. Has anyone else had success with this, or should I be going on my router and try to set a proxy of sorts, like 192.168.0.99:80 => 192.168.0.100:32000

Has anyone had success here? I just want to organize my code and have websites for each app instead of different ports across my cluster.

Edit: Adding a services print out.

I am thinking that an option would be to just create a Cloudflare Tunnel and then use that to Proxy out different services. The problem with that, is that it is made public. I was wanting more of a closed network for things dashboard monitoring etc

Edit:

When reading the docs it was telling me that k3s natively uses Flanel, but I saw a blurb that was mentioning that I may need to use: --flannel-external-ip on all of my nodes? I think that is referring to something else though.

Ideally, I am trying to Proxy say: 192.168.0.100:32000 to be at: xx.99:80 so that way i can have dns entries for: grafana.local

本文标签: kubernetesk3s setting an external IP does not create a new IP on node39s networkStack Overflow