RatioPattern

k8s 可否指定一个 node 作为 nginx ingress 节点?如何配置?

  •  
  •   RatioPattern · Feb 12, 2023 · 2411 views
    This topic created in 1202 days ago, the information mentioned may be changed or developed.

    目前家里有五六台服务器跑了 k8s ,但是家网没有公网 IP 想对外提供服务比较麻烦, 于是加了一台华为云服务器用 vpn 接入家里的 k8s 内网 作为一个节点, 但这台华为云服务器配置比较低,是希望只用他做 nginx ingress 节点转发公网流量,不要跑任何 pods 这样能否实现,如何配置?或者有更好的方式?

    9 replies    2023-02-13 10:14:00 +08:00
    nulIptr
        1
    nulIptr  
       Feb 12, 2023
    搜下 taint/affinity ,都可以实现
    seers
        2
    seers  
       Feb 12, 2023 via Android
    给 node 打污点,然后 pod 给容忍就行
    xvan
        3
    xvan  
       Feb 12, 2023
    亲和性
    nihaoworld
        4
    nihaoworld  
       Feb 12, 2023
    1. 不跑任何其他 pods:taint
    2. 做 nginx ingress 节点: 容忍 taint 的同时,加 nodeSelector 或 affinity
    RatioPattern
        5
    RatioPattern  
    OP
       Feb 13, 2023
    @xqiang 第二点,公网华为云这个 k8s node 不跑业务 pods(k8s 自己的服务 Pods 不算)只当 nginx ingress 节点,也需要初始化 nginx ingress 服务 pods 的时候加 nodeSelector 选中公网华为云 node 吗?
    RatioPattern
        6
    RatioPattern  
    OP
       Feb 13, 2023
    补充下,是希望 nginx ingress 为全局生效,代理多个不同 namespace 的 svc 出去。。。
    littlezzll
        7
    littlezzll  
       Feb 13, 2023 via Android
    给指定节点打标签,比如 ingress=true ,nodeSelector 指定这个标签即可
    julyclyde
        8
    julyclyde  
       Feb 13, 2023
    我总觉得 nodeport 模式的 service 是一个设计错误
    并非所有 node 都对外服务,但是一个 service 需要在所有 node 上都占有端口,浪费资源,增加协调难度
    端口如果用完了咋办呢?每个集群只能有六万多个 service ?
    x8
        9
    x8  
       Feb 13, 2023   ❤️ 1
    除了上面提到的方式,还可以指定 pod 的 nodeName
    https://kubernetes.io/zh-cn/docs/concepts/scheduling-eviction/assign-pod-node/#nodename

    链接中整篇官方文档正好对应你的问题
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2383 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 47ms · UTC 16:04 · PVG 00:04 · LAX 09:04 · JFK 12:04
    ♥ Do have faith in what you're doing.