Ingress 端口转发

一、Ingress controller添加参数

配置文件 ingress-controller

# kubectl edit daemonset ingress-nginx-controller -n ingress-nginx
​
- --tcp-services-configmap=$(POD_NAMESPACE)/tcp-services
- --udp-services-configmap=$(POD_NAMESPACE)/udp-services

  

二、新增configmap

apiVersion: v1
kind: ConfigMap
metadata:
  name: tcp-services
  namespace: ingress-nginx
data:
  6379: "default/redis-cluster-connection:6379"
  • 6379: "default/redis-cluster-connection:6379" : 将default NameSpace下redis-cluster-connection这个Service的端口6379通过ingress节点的6379端口转发

三、查看ingress转发配置

# TCP services
    
    server {
        preread_by_lua_block {
            ngx.var.proxy_upstream_name="tcp-default-redis-cluster-connection-6379";
        }
        
        listen                  6379;
        
        listen                  [::]:6379;
​

 

posted @ 2020-11-26 10:01  Bigberg  阅读(2402)  评论(0编辑  收藏  举报