<p>What is the port opened by kube-proxy for，Why does it listen on so many ports?
From my node, I can see that kube-proxy is listening to a lot of ports. Can someone explain to me why they are listening to so many ports and what is it for?
the output like below:</p>

<pre><code>[root@runsdata-test-0001 ~]# netstat -antup|grep kube-proxy
tcp        0      0 127.0.0.1:10249         0.0.0.0:*               LISTEN      14370/kube-proxy    
tcp        0      0 10.0.0.154:59638        10.0.0.154:6443         ESTABLISHED 14370/kube-proxy    
tcp6       0      0 :::31860                :::*                    LISTEN      14370/kube-proxy    
tcp6       0      0 :::11989                :::*                    LISTEN      14370/kube-proxy    
tcp6       0      0 :::26879                :::*                    LISTEN      14370/kube-proxy    
tcp6       0      0 :::8100                 :::*                    LISTEN      14370/kube-proxy    
tcp6       0      0 :::10055                :::*                    LISTEN      14370/kube-proxy    
tcp6       0      0 :::27688                :::*                    LISTEN      14370/kube-proxy    
tcp6       0      0 :::29932                :::*                    LISTEN      14370/kube-proxy    
tcp6       0      0 :::4303                 :::*                    LISTEN      14370/kube-proxy    
tcp6       0      0 :::31504                :::*                    LISTEN      14370/kube-proxy    
tcp6       0      0 :::10256                :::*                    LISTEN      14370/kube-proxy    
tcp6       0      0 :::21201                :::*                    LISTEN      14370/kube-proxy    
[root@runsdata-test-0001 ~]# ss -antup|grep kube-proxy
tcp    LISTEN     0      128    127.0.0.1:10249                 *:*                   users:(("kube-proxy",pid=14370,fd=9))
tcp    ESTAB      0      0      10.0.0.154:59638              10.0.0.154:6443                users:(("kube-proxy",pid=14370,fd=6))
tcp    LISTEN     0      128    [::]:31860              [::]:*                   users:(("kube-proxy",pid=14370,fd=16))
tcp    LISTEN     0      128    [::]:11989              [::]:*                   users:(("kube-proxy",pid=14370,fd=18))
tcp    LISTEN     0      128    [::]:26879              [::]:*                   users:(("kube-proxy",pid=14370,fd=11))
tcp    LISTEN     0      128    [::]:8100               [::]:*                   users:(("kube-proxy",pid=14370,fd=17))
tcp    LISTEN     0      128    [::]:10055              [::]:*                   users:(("kube-proxy",pid=14370,fd=14))
tcp    LISTEN     0      128    [::]:27688              [::]:*                   users:(("kube-proxy",pid=14370,fd=13))
tcp    LISTEN     0      128    [::]:29932              [::]:*                   users:(("kube-proxy",pid=14370,fd=12))
tcp    LISTEN     0      128    [::]:4303               [::]:*                   users:(("kube-proxy",pid=14370,fd=10))
tcp    LISTEN     0      128    [::]:31504              [::]:*                   users:(("kube-proxy",pid=14370,fd=3))
tcp    LISTEN     0      128    [::]:10256              [::]:*                   users:(("kube-proxy",pid=14370,fd=8))
tcp    LISTEN     0      128    [::]:21201              [::]:*                   users:(("kube-proxy",pid=14370,fd=15))
</code></pre>

<p>As can be seen from the following results, the port that kube-proxy listens on is not the port for every service of type clusterip or nodeport. most service port is not being listened on</p>

<pre><code>[root@runsdata-test-0001 ~]# kubectl get svc -o wide
NAME                                                     TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)                   AGE   SELECTOR
admin-dashboard                                          ClusterIP   10.0.6.133   &lt;none&gt;        8652/TCP                  76d   app=admin-dashboard
basic-customer-service-web                               ClusterIP   10.0.6.70    &lt;none&gt;        80/TCP                    88d   app=basic-customer-service-web
cloud-agent-dashboard-web                                ClusterIP   10.0.6.82    &lt;none&gt;        80/TCP                    88d   app=cloud-agent-dashboard-web
config-server                                            ClusterIP   10.0.6.199   &lt;none&gt;        8100/TCP                  17d   app=config-server
content-management-service-v2-0                          ClusterIP   10.0.6.149   &lt;none&gt;        8511/TCP                  88d   app=content-management-service-v2-0
customer-service-web-v1                                  ClusterIP   10.0.6.64    &lt;none&gt;        80/TCP                    88d   app=customer-service-web-v1
customer-service-web-v2                                  ClusterIP   10.0.6.12    &lt;none&gt;        80/TCP                    88d   app=customer-service-web-v2
default-http-backend                                     ClusterIP   10.0.6.102   &lt;none&gt;        80/TCP                    62d   k8s-app=default-http-backend
file-server                                              ClusterIP   10.0.6.221   &lt;none&gt;        80/TCP                    88d   app=file-server
glusterfs-cluster                                        ClusterIP   10.0.6.197   &lt;none&gt;        1990/TCP                  88d   &lt;none&gt;
glusterfs-dynamic-2364ef3c-21d9-4b57-8416-3bec33191c63   ClusterIP   10.0.6.145   &lt;none&gt;        1/TCP                     76d   &lt;none&gt;
glusterfs-dynamic-4cebf743-e9a3-4bc0-b96a-e3bca2d7c65b   ClusterIP   10.0.6.139   &lt;none&gt;        1/TCP                     76d   &lt;none&gt;
glusterfs-dynamic-65ab49bf-ea94-471a-be8a-ba9a32eca3f2   ClusterIP   10.0.6.72    &lt;none&gt;        1/TCP                     76d   &lt;none&gt;
glusterfs-dynamic-86817d19-5173-4dfb-a09f-b27785d62619   ClusterIP   10.0.6.42    &lt;none&gt;        1/TCP                     76d   &lt;none&gt;
glusterfs-dynamic-8b31e26e-b33d-4ddf-8604-287b015f4463   ClusterIP   10.0.6.40    &lt;none&gt;        1/TCP                     76d   &lt;none&gt;
glusterfs-dynamic-8ede2720-863d-4329-8c7a-7bc2a7f540e4   ClusterIP   10.0.6.148   &lt;none&gt;        1/TCP                     76d   &lt;none&gt;
glusterfs-dynamic-b0d2f15d-847c-44e6-8272-0390d42806d1   ClusterIP   10.0.6.185   &lt;none&gt;        1/TCP                     76d   &lt;none&gt;
glusterfs-dynamic-b16b2a65-d21d-412e-88b5-ca5fb5ce8626   ClusterIP   10.0.6.29    &lt;none&gt;        1/TCP                     76d   &lt;none&gt;
glusterfs-dynamic-ee1be4cc-d90f-4ac4-a662-6a6fdc25e628   ClusterIP   10.0.6.251   &lt;none&gt;        1/TCP                     76d   &lt;none&gt;
hr-dashboard-web-global                                  ClusterIP   10.0.6.66    &lt;none&gt;        80/TCP                    88d   app=hr-dashboard-web-global
hystrix-dashboard                                        ClusterIP   10.0.6.87    &lt;none&gt;        8650/TCP                  48d   app=hystrix-dashboard
kafka-hs                                                 ClusterIP   None         &lt;none&gt;        9092/TCP                  76d   app=kafka
kafka-server                                             ClusterIP   10.0.6.209   &lt;none&gt;        9092/TCP                  76d   app=kafka
mongo-master                                             ClusterIP   10.0.6.39    &lt;none&gt;        27017/TCP                 88d   name=mongo
mongodb-1                                                ClusterIP   10.0.6.11    &lt;none&gt;        27017/TCP                 17d   &lt;none&gt;
mongodb-2                                                ClusterIP   10.0.6.55    &lt;none&gt;        27017/TCP                 17d   &lt;none&gt;
mongodb-3                                                ClusterIP   10.0.6.114   &lt;none&gt;        27017/TCP                 17d   &lt;none&gt;
mysql-master                                             ClusterIP   10.0.6.201   &lt;none&gt;        3306/TCP                  88d   &lt;none&gt;
news-content-management-web                              ClusterIP   10.0.6.93    &lt;none&gt;        80/TCP                    61d   app=news-content-management-web
peony-ali-api                                            ClusterIP   10.0.6.151   &lt;none&gt;        9220/TCP                  62d   app=peony-ali-api
peony-app-update                                         ClusterIP   10.0.6.138   &lt;none&gt;        9410/TCP                  87d   app=peony-app-update
peony-authenticate-storage-service-v3-0                  ClusterIP   10.0.6.37    &lt;none&gt;        8241/TCP                  88d   app=peony-authenticate-storage-service-v3-0
peony-hr-file-server                                     ClusterIP   10.0.6.53    &lt;none&gt;        80/TCP                    87d   app=peony-hr-file-server
peony-infrastructure-gateway                             ClusterIP   10.0.6.132   &lt;none&gt;        8020/TCP                  60d   app=peony-infrastructure-gateway
peony-log-file-server                                    ClusterIP   10.0.6.54    &lt;none&gt;        80/TCP                    14d   app=peony-log-file-server
peony-media-hr-file-server                               ClusterIP   10.0.6.129   &lt;none&gt;        80/TCP                    87d   app=peony-media-hr-file-server
peony-medical-file-server                                ClusterIP   10.0.6.31    &lt;none&gt;        80/TCP                    87d   app=peony-medical-file-server
peony-online-file-server                                 ClusterIP   10.0.6.217   &lt;none&gt;        80/TCP                    87d   app=peony-online-file-server
peony-payment-service                                    ClusterIP   10.0.6.38    &lt;none&gt;        9400/TCP                  87d   app=peony-payment-service
peony-sms-api                                            ClusterIP   10.0.6.204   &lt;none&gt;        9200/TCP                  87d   app=peony-sms-api
peony-sms-gateway                                        ClusterIP   10.0.6.7     &lt;none&gt;        80/TCP                    87d   app=peony-sms-gateway
peony-sms-sender                                         ClusterIP   10.0.6.135   &lt;none&gt;        9211/TCP                  87d   app=peony-sms-sender
peony-sms-web                                            ClusterIP   10.0.6.74    &lt;none&gt;        80/TCP                    61d   app=peony-sms-web
plum-gatherer-api                                        ClusterIP   10.0.6.239   &lt;none&gt;        80/TCP                    87d   app=plum-gatherer-api
plum-gatherer-gateway                                    ClusterIP   10.0.6.67    &lt;none&gt;        7010/TCP                  87d   app=plum-gatherer-gateway
plum-live-gatherer                                       ClusterIP   10.0.6.187   &lt;none&gt;        7011/TCP                  87d   app=plum-live-gatherer
rabbit-server                                            ClusterIP   10.0.6.125   &lt;none&gt;        5672/TCP,15672/TCP        68d   app=rabbit-server
redis-foundation-master                                  ClusterIP   10.0.6.127   &lt;none&gt;        6379/TCP                  17d   name=redis-foundation
redis-sentinel-0                                         ClusterIP   10.0.6.203   &lt;none&gt;        36379/TCP                 20d   &lt;none&gt;
redis-sentinel-1                                         ClusterIP   10.0.6.10    &lt;none&gt;        36379/TCP                 20d   &lt;none&gt;
redis-sentinel-2                                         ClusterIP   10.0.6.222   &lt;none&gt;        36379/TCP                 20d   &lt;none&gt;
redis-sms-master                                         ClusterIP   10.0.6.50    &lt;none&gt;        6379/TCP                  87d   name=redis-sms
redis-user-master                                        ClusterIP   10.0.6.71    &lt;none&gt;        6379/TCP                  87d   name=redis-user
si-console-web                                           ClusterIP   10.0.6.88    &lt;none&gt;        80/TCP                    87d   app=si-console-web
si-gov-admin-web                                         ClusterIP   10.0.6.152   &lt;none&gt;        80/TCP                    87d   app=si-gov-admin-web
society-admin-web                                        ClusterIP   10.0.6.105   &lt;none&gt;        80/TCP                    86d   app=society-admin-web
society-admin-web-v2                                     ClusterIP   10.0.6.119   &lt;none&gt;        80/TCP                    49d   app=society-admin-web-v2
society-app-config-service-v2-0                          ClusterIP   10.0.6.112   &lt;none&gt;        8013/TCP                  88d   app=society-app-config-service-v2-0
society-assistance-service-v1-0                          ClusterIP   10.0.6.238   &lt;none&gt;        8531/TCP                  88d   app=society-assistance-service-v1-0
society-authenticate-storage-service-v3-0                ClusterIP   10.0.6.177   &lt;none&gt;        8241/TCP                  35d   app=society-authenticate-storage-service-v3-0
society-authorization-server                             ClusterIP   10.0.6.183   &lt;none&gt;        10681/TCP,9010/TCP        88d   app=society-authorization-server
society-certification-service-v2-0                       ClusterIP   10.0.6.198   &lt;none&gt;        8215/TCP                  88d   app=society-certification-service-v2-0
society-config-app-api                                   ClusterIP   10.0.6.9     &lt;none&gt;        80/TCP                    80d   app=society-config-app-api
society-employment-mobile-universal-web                  ClusterIP   10.0.6.247   &lt;none&gt;        80/TCP                    88d   app=society-employment-mobile-universal-web
society-employment-service-v1-0                          ClusterIP   10.0.6.211   &lt;none&gt;        8541/TCP                  87d   app=society-employment-service-v1-0
society-im-service-v1-0                                  ClusterIP   10.0.6.235   &lt;none&gt;        8551/TCP                  87d   app=society-im-service-v1-0
society-insurance-app-api                                ClusterIP   10.0.6.6     &lt;none&gt;        80/TCP                    88d   app=society-insurance-app-api
society-insurance-foundation-service-v2-0                ClusterIP   10.0.6.49    &lt;none&gt;        8223/TCP                  88d   app=society-insurance-foundation-service-v2-0
society-insurance-gateway                                ClusterIP   10.0.6.202   &lt;none&gt;        8020/TCP                  88d   app=society-insurance-gateway
society-insurance-management-service-v2-0                NodePort    10.0.6.140   &lt;none&gt;        8235:31860/TCP            63d   app=society-insurance-management-service-v2-0
society-insurance-resident-service-v2-0                  ClusterIP   10.0.6.5     &lt;none&gt;        8311/TCP                  88d   app=society-insurance-resident-service-v2-0
society-insurance-storage-service-v2-0                   ClusterIP   10.0.6.2     &lt;none&gt;        8228/TCP                  88d   app=society-insurance-storage-service-v2-0
society-insurance-user-service-v2-0                      ClusterIP   10.0.6.23    &lt;none&gt;        8221/TCP                  88d   app=society-insurance-user-service-v2-0
society-insurance-web-api                                ClusterIP   10.0.6.236   &lt;none&gt;        80/TCP                    88d   app=society-insurance-web-api
society-material-h5-web                                  ClusterIP   10.0.6.43    &lt;none&gt;        80/TCP                    73d   app=society-material-h5-web
society-material-service-v1-0                            ClusterIP   10.0.6.241   &lt;none&gt;        8261/TCP                  67d   app=society-material-service-v1-0
society-material-web                                     ClusterIP   10.0.6.65    &lt;none&gt;        80/TCP                    83d   app=society-material-web
society-notice-service-v1-0                              ClusterIP   10.0.6.16    &lt;none&gt;        8561/TCP                  14d   app=society-notice-service-v1-0
society-online-business-admin-web                        ClusterIP   10.0.6.230   &lt;none&gt;        80/TCP                    88d   app=society-online-business-admin-web
society-online-business-configure-h5-web                 ClusterIP   10.0.6.8     &lt;none&gt;        80/TCP                    88d   app=society-online-business-configure-h5-web
society-online-business-mobile-web                       ClusterIP   10.0.6.137   &lt;none&gt;        80/TCP                    88d   app=society-online-business-mobile-web
society-online-business-mobile-web-v2-0                  ClusterIP   10.0.6.108   &lt;none&gt;        80/TCP                    87d   app=society-online-business-mobile-web-v2-0
society-online-business-mobile-web-v2-1                  ClusterIP   10.0.6.128   &lt;none&gt;        80/TCP                    87d   app=society-online-business-mobile-web-v2-1
society-online-business-processor-service-v1-0           ClusterIP   10.0.6.99    &lt;none&gt;        10042/TCP                 88d   app=global-online-business-processor-service-v1-0
society-online-business-service-v2-0                     ClusterIP   10.0.6.186   &lt;none&gt;        8216/TCP                  88d   app=society-online-business-service-v2-0
society-online-business-service-v2-1                     ClusterIP   10.0.6.162   &lt;none&gt;        8216/TCP                  88d   app=society-online-business-service-v2-1
society-operation-gateway                                ClusterIP   10.0.6.4     &lt;none&gt;        8010/TCP                  88d   app=society-operation-gateway
society-operation-user-service-v1-1                      ClusterIP   10.0.6.35    &lt;none&gt;        8012/TCP                  88d   app=society-operation-user-service-v1-1
society-operator-management-service-v1-0                 ClusterIP   10.0.6.234   &lt;none&gt;        8271/TCP                  83d   app=society-operator-management-service-v1-0
society-operator-management-web                          ClusterIP   10.0.6.150   &lt;none&gt;        80/TCP                    77d   app=society-operator-management-web
society-portal-mobile-universal-web                      ClusterIP   10.0.6.244   &lt;none&gt;        80/TCP                    88d   app=society-portal-mobile-universal-web
society-portal-nationwide-web                            ClusterIP   10.0.6.237   &lt;none&gt;        80/TCP                    88d   app=society-portal-nationwide-web
society-proxy-access-service-v2-0                        ClusterIP   10.0.6.243   &lt;none&gt;        8411/TCP                  58d   app=society-proxy-access-service-v2-0
society-resident-service-v3-0                            ClusterIP   10.0.6.63    &lt;none&gt;        8231/TCP                  88d   app=society-resident-service-v3-0
society-training-exam-web                                ClusterIP   10.0.6.83    &lt;none&gt;        80/TCP                    37d   app=society-training-exam-web
society-training-mobile-universal-web                    ClusterIP   10.0.6.210   &lt;none&gt;        80/TCP                    88d   app=society-training-mobile-universal-web
society-training-service-v1-0                            ClusterIP   10.0.6.36    &lt;none&gt;        8521/TCP                  88d   app=society-training-service-v1-0
society-user-service-v2-0                                ClusterIP   10.0.6.216   &lt;none&gt;        8211/TCP                  87d   app=society-user-service-v2-0
society-user-service-v3-0                                ClusterIP   10.0.6.227   &lt;none&gt;        8211/TCP                  88d   app=society-user-service-v3-0
sports-training-web                                      ClusterIP   10.0.6.123   &lt;none&gt;        80/TCP                    87d   app=sports-training-web
static-file-server                                       ClusterIP   10.0.6.73    &lt;none&gt;        80/TCP                    88d   app=static-file-server
traefik-ingress-controller                               ClusterIP   10.0.6.225   &lt;none&gt;        80/TCP,6080/TCP,443/TCP   17d   app=traefik-ingress-controller
turbine-server                                           ClusterIP   10.0.6.160   &lt;none&gt;        8989/TCP                  76d   app=turbine-server
weedfs-filer                                             ClusterIP   10.0.6.32    &lt;none&gt;        8080/TCP                  19d   app=weedfs-filer
weedfs-master                                            ClusterIP   10.0.6.91    &lt;none&gt;        9333/TCP                  87d   app=weedfs-master
weedfs-volume-1                                          ClusterIP   10.0.6.79    &lt;none&gt;        8080/TCP                  87d   app=weedfs-volume-1
zipkin-server                                            ClusterIP   10.0.6.184   &lt;none&gt;        9411/TCP                  48d   app=zipkin-server
zk-cs                                                    ClusterIP   10.0.6.194   &lt;none&gt;        2181/TCP                  76d   app=zk
zk-hs                                                    ClusterIP   None         &lt;none&gt;        2888/TCP,3888/TCP         76d   app=zk
[root@runsdata-test-0001 ~]# ss -antup|grep kube-proxy
tcp    LISTEN     0      128    127.0.0.1:10249                 *:*                   users:(("kube-proxy",pid=14370,fd=9))
tcp    ESTAB      0      0      10.0.0.154:59638              10.0.0.154:6443                users:(("kube-proxy",pid=14370,fd=6))
tcp    LISTEN     0      128    [::]:31860              [::]:*                   users:(("kube-proxy",pid=14370,fd=16))
tcp    LISTEN     0      128    [::]:11989              [::]:*                   users:(("kube-proxy",pid=14370,fd=18))
tcp    LISTEN     0      128    [::]:26879              [::]:*                   users:(("kube-proxy",pid=14370,fd=11))
tcp    LISTEN     0      128    [::]:8100               [::]:*                   users:(("kube-proxy",pid=14370,fd=17))
tcp    LISTEN     0      128    [::]:10055              [::]:*                   users:(("kube-proxy",pid=14370,fd=14))
tcp    LISTEN     0      128    [::]:27688              [::]:*                   users:(("kube-proxy",pid=14370,fd=13))
tcp    LISTEN     0      128    [::]:29932              [::]:*                   users:(("kube-proxy",pid=14370,fd=12))
tcp    LISTEN     0      128    [::]:4303               [::]:*                   users:(("kube-proxy",pid=14370,fd=10))
tcp    LISTEN     0      128    [::]:31504              [::]:*                   users:(("kube-proxy",pid=14370,fd=3))
tcp    LISTEN     0      128    [::]:10256              [::]:*                   users:(("kube-proxy",pid=14370,fd=8))
tcp    LISTEN     0      128    [::]:21201              [::]:*                   users:(("kube-proxy",pid=14370,fd=15))
[root@runsdata-test-0001 ~]# kubectl get svc -o wide |grep 31860
society-insurance-management-service-v2-0                NodePort    10.0.6.140   &lt;none&gt;        8235:31860/TCP            63d   app=society-insurance-management-service-v2-0
[root@runsdata-test-0001 ~]# kubectl get svc -o wide |grep 11989
[root@runsdata-test-0001 ~]# kubectl get svc -o wide |grep 26879
[root@runsdata-test-0001 ~]# kubectl get svc -o wide |grep 8100
config-server                                            ClusterIP   10.0.6.199   &lt;none&gt;        8100/TCP                  17d   app=config-server
[root@runsdata-test-0001 ~]# kubectl get svc -o wide |grep 10055
[root@runsdata-test-0001 ~]# kubectl get svc -o wide |grep 27688
[root@runsdata-test-0001 ~]# kubectl get svc -o wide |grep 29932
[root@runsdata-test-0001 ~]# kubectl get svc -o wide |grep 4303
[root@runsdata-test-0001 ~]# kubectl get svc -o wide |grep 31504
[root@runsdata-test-0001 ~]# kubectl get svc -o wide |grep 10256
[root@runsdata-test-0001 ~]# kubectl get svc -o wide |grep 21201
[root@runsdata-test-0001 ~]#
</code></pre>

Esc
<p>Based on the <a href="https://kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/" rel="nofollow noreferrer">official documentation</a>:</p>

<blockquote>
  <p>kube-proxy reflects services as defined in the Kubernetes API on each node and can do simple TCP, UDP, and SCTP stream forwarding or round robin TCP, UDP, and SCTP forwarding across a set of backends</p>
</blockquote>

<p>Basically, it listens for the active <code>Service</code>s and forwards them across your cluster.</p>

<p>You can get the list of registered services with:</p>

<pre><code>kubectl --all-namespaces get svc
</code></pre>
