Istio注入的iptables
Istio通过向业务pod中注入init容器以及envoy proxy容器实现流量的劫持与处理,init 容器运行后将在对应的linux namespace里产生以下iptables的NAT表规则
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
[root@k8s-node1-v1-16 ~]# iptables -t nat -L -v Chain PREROUTING (policy ACCEPT 192K packets, 12M bytes) pkts bytes target prot opt in out source destination 192K 12M ISTIO_INBOUND tcp -- any any anywhere anywhere Chain INPUT (policy ACCEPT 192K packets, 12M bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 40673 packets, 3694K bytes) pkts bytes target prot opt in out source destination 8917 535K ISTIO_OUTPUT tcp -- any any anywhere anywhere Chain POSTROUTING (policy ACCEPT 40673 packets, 3694K bytes) pkts bytes target prot opt in out source destination Chain ISTIO_INBOUND (1 references) pkts bytes target prot opt in out source destination 0 0 RETURN tcp -- any any anywhere anywhere tcp dpt:ssh 356 21360 RETURN tcp -- any any anywhere anywhere tcp dpt:15090 192K 11M RETURN tcp -- any any anywhere anywhere tcp dpt:15021 0 0 RETURN tcp -- any any anywhere anywhere tcp dpt:15020 34 2040 ISTIO_IN_REDIRECT tcp -- any any anywhere anywhere Chain ISTIO_IN_REDIRECT (3 references) pkts bytes target prot opt in out source destination 34 2040 REDIRECT tcp -- any any anywhere anywhere redir ports 15006 Chain ISTIO_OUTPUT (1 references) pkts bytes target prot opt in out source destination 0 0 RETURN all -- any lo 127.0.0.6 anywhere 0 0 ISTIO_IN_REDIRECT all -- any lo anywhere !localhost owner UID match 1337 0 0 RETURN all -- any lo anywhere anywhere ! owner UID match 1337 8917 535K RETURN all -- any any anywhere anywhere owner UID match 1337 0 0 ISTIO_IN_REDIRECT all -- any lo anywhere !localhost owner GID match 1337 0 0 RETURN all -- any lo anywhere anywhere ! owner GID match 1337 0 0 RETURN all -- any any anywhere anywhere owner GID match 1337 0 0 RETURN all -- any any anywhere localhost 0 0 ISTIO_REDIRECT all -- any any anywhere anywhere Chain ISTIO_REDIRECT (1 references) pkts bytes target prot opt in out source destination 0 0 REDIRECT tcp -- any any anywhere anywhere redir ports 15001 |
Outbound 流量控制
当业务容器将请求发往外部的时候比如productpage到reviews:9080端口访问,这个连接会被iptables进行redirect到127.0.0.1:15001端口上,进而被envoy处理
REDIRECT
This target is only valid in the nat table, in the PREROUTING and OUTPUT chains, and user-defined chains which are only called from those chains. It redirects the packet to the machine itself by changing the destination IP to the primary address of the incoming interface (locally-generated packets are mapped to the localhost address, 127.0.0.1 for IPv4 and ::1 for IPv6).
https://ipset.netfilter.org/iptables-extensions.man.html#lbDK
envoy中的virtualOutbound将被命中,这是一个特殊的listener,它包含有Original Destination listener filter 即注意以下配置中的"useOriginalDst": true
这样配置后,envoy会在配置中重新查找能够匹配的listener,如果找到则按命中的listener进行后续处理,如果找不到,就将请求交给本listener中cluster,这里是一个passthroughcluster, 这个cluster将会把包直接四层转发出去。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
[root@k8s-master-v1-16 ~]# istioctl proxy-config listener productpage-v1-7f4cc988c6-qxqjs.istio-bookinfo --port 15001 -o json [ { "name": "virtualOutbound", "address": { "socketAddress": { "address": "0.0.0.0", "portValue": 15001 } }, "filterChains": [ { "filters": [ { "name": "istio.stats", "typedConfig": { "@type": "type.googleapis.com/udpa.type.v1.TypedStruct", "typeUrl": "type.googleapis.com/envoy.extensions.filters.network.wasm.v3.Wasm", "value": { "config": { "configuration": "{\n \"debug\": \"false\",\n \"stat_prefix\": \"istio\"\n}\n", "root_id": "stats_outbound", "vm_config": { "code": { "local": { "inline_string": "envoy.wasm.stats" } }, "runtime": "envoy.wasm.runtime.null", "vm_id": "tcp_stats_outbound" } } } } }, { "name": "envoy.tcp_proxy", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "statPrefix": "PassthroughCluster", "cluster": "PassthroughCluster", "accessLog": [ { "name": "envoy.file_access_log", "typedConfig": { "@type": "type.googleapis.com/envoy.config.accesslog.v2.FileAccessLog", "path": "/dev/stdout", "format": "[%START_TIME%] \"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%\" %RESPONSE_CODE% %RESPONSE_FLAGS% \"%DYNAMIC_METADATA(istio.mixer:status)%\" \"%UPSTREAM_TRANSPORT_FAILURE_REASON%\" %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% \"%REQ(X-FORWARDED-FOR)%\" \"%REQ(USER-AGENT)%\" \"%REQ(X-REQUEST-ID)%\" \"%REQ(:AUTHORITY)%\" \"%UPSTREAM_HOST%\" %UPSTREAM_CLUSTER% %UPSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_REMOTE_ADDRESS% %REQUESTED_SERVER_NAME% %ROUTE_NAME%\n" } } ] } } ], "name": "virtualOutbound-catchall-tcp" } ], "useOriginalDst": true, "trafficDirection": "OUTBOUND" } ] |
上面这个listener将会把连接交给能匹配原始目的IP与端口的listener,在bookinfo的例子中将会交给9080的 listener。这里有个问题需要思考,从envoy角度这个链接的目的端口已经是15001了,为什么还能匹配上下面的0.0.0.0:9080端口呢。这里是因为在iptables进行redirect时候是在系统内核里做的NAT,系统内核是有这个转换的存储的,envoy通过getsockopt()获取真实的目的端口,这样就能正确匹配到业务listener了。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
[root@k8s-master-v1-16 ~]# istioctl proxy-config listener productpage-v1-7f4cc988c6-qxqjs.istio-bookinfo --port 9080 -o json [ { "name": "0.0.0.0_9080", "address": { "socketAddress": { "address": "0.0.0.0", "portValue": 9080 } }, "filterChains": [ { "filterChainMatch": { "applicationProtocols": [ "http/1.0", "http/1.1", "h2c" ] }, "filters": [ { "name": "envoy.http_connection_manager", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager", "statPrefix": "outbound_0.0.0.0_9080", "rds": { "configSource": { "ads": {} }, "routeConfigName": "9080" }, |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
[root@k8s-master-v1-16 ~]# istioctl proxy-config listener productpage-v1-7f4cc988c6-qxqjs.istio-bookinfo ADDRESS PORT TYPE 10.102.252.88 15012 TCP 10.96.122.225 31400 TCP 10.96.0.10 53 TCP 10.110.88.185 15443 TCP 10.96.122.225 15443 TCP 10.110.88.185 443 TCP 10.102.252.88 443 TCP 10.106.109.172 9001 TCP 10.96.0.1 443 TCP 10.96.122.225 443 TCP 10.106.109.172 9000 TCP 10.105.130.171 14267 HTTP+TCP 10.96.81.27 5601 HTTP+TCP 0.0.0.0 15014 HTTP+TCP 10.105.130.171 14250 HTTP+TCP 0.0.0.0 20001 HTTP+TCP 0.0.0.0 9411 HTTP+TCP 10.111.37.34 9090 HTTP+TCP 10.105.145.36 80 HTTP+TCP 10.105.130.171 14268 HTTP+TCP 10.96.0.10 9153 HTTP+TCP 10.110.244.188 80 HTTP+TCP 10.102.252.88 853 HTTP+TCP 10.99.139.251 16686 HTTP+TCP 0.0.0.0 12345 HTTP+TCP 10.103.155.149 80 HTTP+TCP 0.0.0.0 8000 HTTP+TCP 0.0.0.0 15010 HTTP+TCP 10.96.122.225 15020 HTTP+TCP 0.0.0.0 9090 HTTP+TCP 10.107.150.251 80 HTTP+TCP 0.0.0.0 14250 HTTP+TCP 0.0.0.0 80 HTTP+TCP 0.0.0.0 3000 HTTP+TCP 10.110.28.96 8181 HTTP+TCP 10.102.69.143 9200 HTTP+TCP 0.0.0.0 9080 HTTP+TCP 《《《《《《《《《《《《 0.0.0.0 15001 TCP 《《《《《《《《《《《《 0.0.0.0 15006 HTTP+TCP 0.0.0.0 15090 HTTP 0.0.0.0 15021 HTTP |
相关的passthrough cluster:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
[root@k8s-master-v1-16 ~]# istioctl proxy-config cluster productpage-v1-7f4cc988c6-qxqjs.istio-bookinfo --fqdn PassthroughCluster -o json [ 。。。。忽略。。。 { "name": "PassthroughCluster", "type": "ORIGINAL_DST", "connectTimeout": "10s", "lbPolicy": "CLUSTER_PROVIDED", "circuitBreakers": { "thresholds": [ { "maxConnections": 4294967295, "maxPendingRequests": 4294967295, "maxRequests": 4294967295, "maxRetries": 4294967295 } ] }, "filters": [ { "name": "istio.metadata_exchange", "typedConfig": { "@type": "type.googleapis.com/udpa.type.v1.TypedStruct", "typeUrl": "type.googleapis.com/envoy.tcp.metadataexchange.config.MetadataExchange", "value": { "protocol": "istio-peer-exchange" } } } ] } ] |
Inbound流量控制
当是一个inbound的请求时候,这个时候包的目的地址是pod的IP,目的端口是业务的真实端口(9080,非svc的映射port),由于iptables这个链接目的端口被重改为15006了,会命中virtual inbound listener(0.0.0.0:15006), 这个listener里有一系列的filterchain,和virtualoutbound的listener配置方法不同,在virtualinbound里包含了一系列具体端口的实际业务filter,连接将在这些fitlers里找到具体的业务匹配。那它是怎么匹配到真的9080的业务的?比如下面的输出:
addressPrefix是可以匹配的,如果这个pod实际有多个port的话,仅addressPrefix匹配不行,还需要匹配应用层协议,但是Match条件里的destinationPort没有被匹配,实际上这里和Virtualoutbound类似,也使用了original destination这个listener的filter,因此envoy将从内核里获取到真实的目的端口与IP,这个配置方法与virtualoutbound的"useOriginalDst": true 配置方法不同,因为这是一个更新的配置方式,"useOriginalDst": true这种配置方式即将被废弃。
"listenerFilters": [ { "name": "envoy.listener.original_dst", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.listener.original_dst.v2.OriginalDst" } },
(根据https://www.envoyproxy.io/docs/envoy/latest/api-v2/api/v2/listener/listener_components.proto, filtermatch条件是要全部匹配才可以)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
{ "filterChainMatch": { "destinationPort": 9080, "prefixRanges": [ { "addressPrefix": "10.244.2.138", "prefixLen": 32 } ], ### 根据https://istio.io/latest/zh/docs/ops/deployment/requirements/ , ### 同一个业务端口是不能被两个用不同协议的svc来发布的,因此这帮助避免了同端口同协议的match在整个配置文件里的出现。 "applicationProtocols": [ "istio", "istio-http/1.0", "istio-http/1.1", "istio-h2" ] }, "filters": [ { "name": "istio.metadata_exchange", "typedConfig": { "@type": "type.googleapis.com/udpa.type.v1.TypedStruct", "typeUrl": "type.googleapis.com/envoy.tcp.metadataexchange.config.MetadataExchange", "value": { "protocol": "istio-peer-exchange" } } }, { "name": "envoy.http_connection_manager", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager", "statPrefix": "inbound_10.244.2.138_9080", "routeConfig": { "name": "inbound|9080|http|productpage.istio-bookinfo.svc.cluster.local", "virtualHosts": [ { "name": "inbound|http|9080", "domains": [ "*" ], "routes": [ { "name": "default", "match": { "prefix": "/" }, "route": { "cluster": "inbound|9080|http|productpage.istio-bookinfo.svc.cluster.local", "timeout": "0s", "maxGrpcTimeout": "0s" }, "decorator": { "operation": "productpage.istio-bookinfo.svc.cluster.local:9080/*" } } ] } ], |
附15006的实际配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 |
[root@k8s-master-v1-16 ~]# istioctl proxy-config listener productpage-v1-7f4cc988c6-qxqjs.istio-bookinfo --port 15006 -o json [ { "name": "virtualInbound", "address": { "socketAddress": { "address": "0.0.0.0", "portValue": 15006 } }, "filterChains": [ { "filterChainMatch": { "prefixRanges": [ { "addressPrefix": "0.0.0.0", "prefixLen": 0 } ], "transportProtocol": "tls", "applicationProtocols": [ "istio-peer-exchange", "istio" ] }, "filters": [ { "name": "istio.metadata_exchange", "typedConfig": { "@type": "type.googleapis.com/udpa.type.v1.TypedStruct", "typeUrl": "type.googleapis.com/envoy.tcp.metadataexchange.config.MetadataExchange", "value": { "protocol": "istio-peer-exchange" } } }, { "name": "istio.stats", "typedConfig": { "@type": "type.googleapis.com/udpa.type.v1.TypedStruct", "typeUrl": "type.googleapis.com/envoy.extensions.filters.network.wasm.v3.Wasm", "value": { "config": { "configuration": "{\n \"debug\": \"false\",\n \"stat_prefix\": \"istio\"\n}\n", "root_id": "stats_inbound", "vm_config": { "code": { "local": { "inline_string": "envoy.wasm.stats" } }, "runtime": "envoy.wasm.runtime.null", "vm_id": "tcp_stats_inbound" } } } } }, { "name": "envoy.tcp_proxy", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "statPrefix": "InboundPassthroughClusterIpv4", "cluster": "InboundPassthroughClusterIpv4", "accessLog": [ { "name": "envoy.file_access_log", "typedConfig": { "@type": "type.googleapis.com/envoy.config.accesslog.v2.FileAccessLog", "path": "/dev/stdout", "format": "[%START_TIME%] \"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%\" %RESPONSE_CODE% %RESPONSE_FLAGS% \"%DYNAMIC_METADATA(istio.mixer:status)%\" \"%UPSTREAM_TRANSPORT_FAILURE_REASON%\" %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% \"%REQ(X-FORWARDED-FOR)%\" \"%REQ(USER-AGENT)%\" \"%REQ(X-REQUEST-ID)%\" \"%REQ(:AUTHORITY)%\" \"%UPSTREAM_HOST%\" %UPSTREAM_CLUSTER% %UPSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_REMOTE_ADDRESS% %REQUESTED_SERVER_NAME% %ROUTE_NAME%\n" } } ] } } ], "transportSocket": { "name": "envoy.transport_sockets.tls", "typedConfig": { "@type": "type.googleapis.com/envoy.api.v2.auth.DownstreamTlsContext", "commonTlsContext": { "tlsCertificateSdsSecretConfigs": [ { "name": "default", "sdsConfig": { "apiConfigSource": { "apiType": "GRPC", "grpcServices": [ { "envoyGrpc": { "clusterName": "sds-grpc" } } ] } } } ], "combinedValidationContext": { "defaultValidationContext": {}, "validationContextSdsSecretConfig": { "name": "ROOTCA", "sdsConfig": { "apiConfigSource": { "apiType": "GRPC", "grpcServices": [ { "envoyGrpc": { "clusterName": "sds-grpc" } } ] } } } }, "alpnProtocols": [ "istio-peer-exchange", "h2", "http/1.1" ] }, "requireClientCertificate": true } }, "name": "virtualInbound" }, { "filterChainMatch": { "prefixRanges": [ { "addressPrefix": "0.0.0.0", "prefixLen": 0 } ] }, "filters": [ { "name": "istio.metadata_exchange", "typedConfig": { "@type": "type.googleapis.com/udpa.type.v1.TypedStruct", "typeUrl": "type.googleapis.com/envoy.tcp.metadataexchange.config.MetadataExchange", "value": { "protocol": "istio-peer-exchange" } } }, { "name": "istio.stats", "typedConfig": { "@type": "type.googleapis.com/udpa.type.v1.TypedStruct", "typeUrl": "type.googleapis.com/envoy.extensions.filters.network.wasm.v3.Wasm", "value": { "config": { "configuration": "{\n \"debug\": \"false\",\n \"stat_prefix\": \"istio\"\n}\n", "root_id": "stats_inbound", "vm_config": { "code": { "local": { "inline_string": "envoy.wasm.stats" } }, "runtime": "envoy.wasm.runtime.null", "vm_id": "tcp_stats_inbound" } } } } }, { "name": "envoy.tcp_proxy", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "statPrefix": "InboundPassthroughClusterIpv4", "cluster": "InboundPassthroughClusterIpv4", "accessLog": [ { "name": "envoy.file_access_log", "typedConfig": { "@type": "type.googleapis.com/envoy.config.accesslog.v2.FileAccessLog", "path": "/dev/stdout", "format": "[%START_TIME%] \"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%\" %RESPONSE_CODE% %RESPONSE_FLAGS% \"%DYNAMIC_METADATA(istio.mixer:status)%\" \"%UPSTREAM_TRANSPORT_FAILURE_REASON%\" %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% \"%REQ(X-FORWARDED-FOR)%\" \"%REQ(USER-AGENT)%\" \"%REQ(X-REQUEST-ID)%\" \"%REQ(:AUTHORITY)%\" \"%UPSTREAM_HOST%\" %UPSTREAM_CLUSTER% %UPSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_REMOTE_ADDRESS% %REQUESTED_SERVER_NAME% %ROUTE_NAME%\n" } } ] } } ], "name": "virtualInbound" }, { "filterChainMatch": { "prefixRanges": [ { "addressPrefix": "0.0.0.0", "prefixLen": 0 } ], "transportProtocol": "tls", "applicationProtocols": [ "http/1.0", "http/1.1", "h2c", "istio-http/1.0", "istio-http/1.1", "istio-h2" ] }, "filters": [ { "name": "istio.metadata_exchange", "typedConfig": { "@type": "type.googleapis.com/udpa.type.v1.TypedStruct", "typeUrl": "type.googleapis.com/envoy.tcp.metadataexchange.config.MetadataExchange", "value": { "protocol": "istio-peer-exchange" } } }, { "name": "envoy.http_connection_manager", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager", "statPrefix": "InboundPassthroughClusterIpv4", "routeConfig": { "name": "InboundPassthroughClusterIpv4", "virtualHosts": [ { "name": "inbound|http|0", "domains": [ "*" ], "routes": [ { "name": "default", "match": { "prefix": "/" }, "route": { "cluster": "InboundPassthroughClusterIpv4", "timeout": "0s", "maxGrpcTimeout": "0s" }, "decorator": { "operation": ":0/*" } } ] } ], "validateClusters": false }, "httpFilters": [ { "name": "istio.metadata_exchange", "typedConfig": { "@type": "type.googleapis.com/udpa.type.v1.TypedStruct", "typeUrl": "type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm", "value": { "config": { "configuration": "{}\n", "vm_config": { "code": { "local": { "inline_string": "envoy.wasm.metadata_exchange" } }, "runtime": "envoy.wasm.runtime.null" } } } } }, { "name": "envoy.cors", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.http.cors.v2.Cors" } }, { "name": "envoy.fault", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.http.fault.v2.HTTPFault" } }, { "name": "istio.stats", "typedConfig": { "@type": "type.googleapis.com/udpa.type.v1.TypedStruct", "typeUrl": "type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm", "value": { "config": { "configuration": "{\n \"debug\": \"false\",\n \"stat_prefix\": \"istio\"\n}\n", "root_id": "stats_inbound", "vm_config": { "code": { "local": { "inline_string": "envoy.wasm.stats" } }, "runtime": "envoy.wasm.runtime.null", "vm_id": "stats_inbound" } } } } }, { "name": "envoy.router", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.http.router.v2.Router" } } ], "tracing": { "clientSampling": { "value": 100 }, "randomSampling": { "value": 100 }, "overallSampling": { "value": 100 } }, "serverName": "istio-envoy", "streamIdleTimeout": "0s", "accessLog": [ { "name": "envoy.file_access_log", "typedConfig": { "@type": "type.googleapis.com/envoy.config.accesslog.v2.FileAccessLog", "path": "/dev/stdout", "format": "[%START_TIME%] \"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%\" %RESPONSE_CODE% %RESPONSE_FLAGS% \"%DYNAMIC_METADATA(istio.mixer:status)%\" \"%UPSTREAM_TRANSPORT_FAILURE_REASON%\" %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% \"%REQ(X-FORWARDED-FOR)%\" \"%REQ(USER-AGENT)%\" \"%REQ(X-REQUEST-ID)%\" \"%REQ(:AUTHORITY)%\" \"%UPSTREAM_HOST%\" %UPSTREAM_CLUSTER% %UPSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_REMOTE_ADDRESS% %REQUESTED_SERVER_NAME% %ROUTE_NAME%\n" } } ], "useRemoteAddress": false, "generateRequestId": true, "forwardClientCertDetails": "APPEND_FORWARD", "setCurrentClientCertDetails": { "subject": true, "dns": true, "uri": true }, "upgradeConfigs": [ { "upgradeType": "websocket" } ], "normalizePath": true } } ], "transportSocket": { "name": "envoy.transport_sockets.tls", "typedConfig": { "@type": "type.googleapis.com/envoy.api.v2.auth.DownstreamTlsContext", "commonTlsContext": { "tlsCertificateSdsSecretConfigs": [ { "name": "default", "sdsConfig": { "apiConfigSource": { "apiType": "GRPC", "grpcServices": [ { "envoyGrpc": { "clusterName": "sds-grpc" } } ] } } } ], "combinedValidationContext": { "defaultValidationContext": {}, "validationContextSdsSecretConfig": { "name": "ROOTCA", "sdsConfig": { "apiConfigSource": { "apiType": "GRPC", "grpcServices": [ { "envoyGrpc": { "clusterName": "sds-grpc" } } ] } } } }, "alpnProtocols": [ "h2", "http/1.1" ] }, "requireClientCertificate": true } }, "name": "virtualInbound-catchall-http" }, { "filterChainMatch": { "prefixRanges": [ { "addressPrefix": "0.0.0.0", "prefixLen": 0 } ], "applicationProtocols": [ "http/1.0", "http/1.1", "h2c" ] }, "filters": [ { "name": "istio.metadata_exchange", "typedConfig": { "@type": "type.googleapis.com/udpa.type.v1.TypedStruct", "typeUrl": "type.googleapis.com/envoy.tcp.metadataexchange.config.MetadataExchange", "value": { "protocol": "istio-peer-exchange" } } }, { "name": "envoy.http_connection_manager", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager", "statPrefix": "InboundPassthroughClusterIpv4", "routeConfig": { "name": "InboundPassthroughClusterIpv4", "virtualHosts": [ { "name": "inbound|http|0", "domains": [ "*" ], "routes": [ { "name": "default", "match": { "prefix": "/" }, "route": { "cluster": "InboundPassthroughClusterIpv4", "timeout": "0s", "maxGrpcTimeout": "0s" }, "decorator": { "operation": ":0/*" } } ] } ], "validateClusters": false }, "httpFilters": [ { "name": "istio.metadata_exchange", "typedConfig": { "@type": "type.googleapis.com/udpa.type.v1.TypedStruct", "typeUrl": "type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm", "value": { "config": { "configuration": "{}\n", "vm_config": { "code": { "local": { "inline_string": "envoy.wasm.metadata_exchange" } }, "runtime": "envoy.wasm.runtime.null" } } } } }, { "name": "envoy.cors", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.http.cors.v2.Cors" } }, { "name": "envoy.fault", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.http.fault.v2.HTTPFault" } }, { "name": "istio.stats", "typedConfig": { "@type": "type.googleapis.com/udpa.type.v1.TypedStruct", "typeUrl": "type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm", "value": { "config": { "configuration": "{\n \"debug\": \"false\",\n \"stat_prefix\": \"istio\"\n}\n", "root_id": "stats_inbound", "vm_config": { "code": { "local": { "inline_string": "envoy.wasm.stats" } }, "runtime": "envoy.wasm.runtime.null", "vm_id": "stats_inbound" } } } } }, { "name": "envoy.router", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.http.router.v2.Router" } } ], "tracing": { "clientSampling": { "value": 100 }, "randomSampling": { "value": 100 }, "overallSampling": { "value": 100 } }, "serverName": "istio-envoy", "streamIdleTimeout": "0s", "accessLog": [ { "name": "envoy.file_access_log", "typedConfig": { "@type": "type.googleapis.com/envoy.config.accesslog.v2.FileAccessLog", "path": "/dev/stdout", "format": "[%START_TIME%] \"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%\" %RESPONSE_CODE% %RESPONSE_FLAGS% \"%DYNAMIC_METADATA(istio.mixer:status)%\" \"%UPSTREAM_TRANSPORT_FAILURE_REASON%\" %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% \"%REQ(X-FORWARDED-FOR)%\" \"%REQ(USER-AGENT)%\" \"%REQ(X-REQUEST-ID)%\" \"%REQ(:AUTHORITY)%\" \"%UPSTREAM_HOST%\" %UPSTREAM_CLUSTER% %UPSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_REMOTE_ADDRESS% %REQUESTED_SERVER_NAME% %ROUTE_NAME%\n" } } ], "useRemoteAddress": false, "generateRequestId": true, "forwardClientCertDetails": "APPEND_FORWARD", "setCurrentClientCertDetails": { "subject": true, "dns": true, "uri": true }, "upgradeConfigs": [ { "upgradeType": "websocket" } ], "normalizePath": true } } ], "name": "virtualInbound-catchall-http" }, { "filterChainMatch": { "destinationPort": 15021, "prefixRanges": [ { "addressPrefix": "10.244.2.155", "prefixLen": 32 } ] }, "filters": [ { "name": "istio.metadata_exchange", "typedConfig": { "@type": "type.googleapis.com/udpa.type.v1.TypedStruct", "typeUrl": "type.googleapis.com/envoy.tcp.metadataexchange.config.MetadataExchange", "value": { "protocol": "istio-peer-exchange" } } }, { "name": "istio.stats", "typedConfig": { "@type": "type.googleapis.com/udpa.type.v1.TypedStruct", "typeUrl": "type.googleapis.com/envoy.extensions.filters.network.wasm.v3.Wasm", "value": { "config": { "configuration": "{\n \"debug\": \"false\",\n \"stat_prefix\": \"istio\"\n}\n", "root_id": "stats_inbound", "vm_config": { "code": { "local": { "inline_string": "envoy.wasm.stats" } }, "runtime": "envoy.wasm.runtime.null", "vm_id": "tcp_stats_inbound" } } } } }, { "name": "envoy.tcp_proxy", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.network.tcp_proxy.v2.TcpProxy", "statPrefix": "inbound|15021|mgmt-15021|mgmtCluster", "cluster": "inbound|15021|mgmt-15021|mgmtCluster", "accessLog": [ { "name": "envoy.file_access_log", "typedConfig": { "@type": "type.googleapis.com/envoy.config.accesslog.v2.FileAccessLog", "path": "/dev/stdout", "format": "[%START_TIME%] \"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%\" %RESPONSE_CODE% %RESPONSE_FLAGS% \"%DYNAMIC_METADATA(istio.mixer:status)%\" \"%UPSTREAM_TRANSPORT_FAILURE_REASON%\" %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% \"%REQ(X-FORWARDED-FOR)%\" \"%REQ(USER-AGENT)%\" \"%REQ(X-REQUEST-ID)%\" \"%REQ(:AUTHORITY)%\" \"%UPSTREAM_HOST%\" %UPSTREAM_CLUSTER% %UPSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_REMOTE_ADDRESS% %REQUESTED_SERVER_NAME% %ROUTE_NAME%\n" } } ] } } ], "name": "10.244.2.155_15021" }, { "filterChainMatch": { "destinationPort": 9080, "prefixRanges": [ { "addressPrefix": "10.244.2.155", "prefixLen": 32 } ], "applicationProtocols": [ "istio", "istio-http/1.0", "istio-http/1.1", "istio-h2" ] }, "filters": [ { "name": "istio.metadata_exchange", "typedConfig": { "@type": "type.googleapis.com/udpa.type.v1.TypedStruct", "typeUrl": "type.googleapis.com/envoy.tcp.metadataexchange.config.MetadataExchange", "value": { "protocol": "istio-peer-exchange" } } }, { "name": "envoy.http_connection_manager", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager", "statPrefix": "inbound_10.244.2.155_9080", "routeConfig": { "name": "inbound|9080|http|productpage.istio-bookinfo.svc.cluster.local", "virtualHosts": [ { "name": "inbound|http|9080", "domains": [ "*" ], "routes": [ { "name": "default", "match": { "prefix": "/" }, "route": { "cluster": "inbound|9080|http|productpage.istio-bookinfo.svc.cluster.local", "timeout": "0s", "maxGrpcTimeout": "0s" }, "decorator": { "operation": "productpage.istio-bookinfo.svc.cluster.local:9080/*" } } ] } ], "validateClusters": false }, "httpFilters": [ { "name": "istio.metadata_exchange", "typedConfig": { "@type": "type.googleapis.com/udpa.type.v1.TypedStruct", "typeUrl": "type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm", "value": { "config": { "configuration": "{}\n", "vm_config": { "code": { "local": { "inline_string": "envoy.wasm.metadata_exchange" } }, "runtime": "envoy.wasm.runtime.null" } } } } }, { "name": "istio_authn", "typedConfig": { "@type": "type.googleapis.com/istio.envoy.config.filter.http.authn.v2alpha1.FilterConfig", "policy": { "peers": [ { "mtls": { "mode": "PERMISSIVE" } } ] } } }, { "name": "envoy.cors", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.http.cors.v2.Cors" } }, { "name": "envoy.fault", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.http.fault.v2.HTTPFault" } }, { "name": "istio.stats", "typedConfig": { "@type": "type.googleapis.com/udpa.type.v1.TypedStruct", "typeUrl": "type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm", "value": { "config": { "configuration": "{\n \"debug\": \"false\",\n \"stat_prefix\": \"istio\"\n}\n", "root_id": "stats_inbound", "vm_config": { "code": { "local": { "inline_string": "envoy.wasm.stats" } }, "runtime": "envoy.wasm.runtime.null", "vm_id": "stats_inbound" } } } } }, { "name": "envoy.router", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.http.router.v2.Router" } } ], "tracing": { "clientSampling": { "value": 100 }, "randomSampling": { "value": 100 }, "overallSampling": { "value": 100 } }, "serverName": "istio-envoy", "streamIdleTimeout": "0s", "accessLog": [ { "name": "envoy.file_access_log", "typedConfig": { "@type": "type.googleapis.com/envoy.config.accesslog.v2.FileAccessLog", "path": "/dev/stdout", "format": "[%START_TIME%] \"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%\" %RESPONSE_CODE% %RESPONSE_FLAGS% \"%DYNAMIC_METADATA(istio.mixer:status)%\" \"%UPSTREAM_TRANSPORT_FAILURE_REASON%\" %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% \"%REQ(X-FORWARDED-FOR)%\" \"%REQ(USER-AGENT)%\" \"%REQ(X-REQUEST-ID)%\" \"%REQ(:AUTHORITY)%\" \"%UPSTREAM_HOST%\" %UPSTREAM_CLUSTER% %UPSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_REMOTE_ADDRESS% %REQUESTED_SERVER_NAME% %ROUTE_NAME%\n" } } ], "useRemoteAddress": false, "generateRequestId": true, "forwardClientCertDetails": "APPEND_FORWARD", "setCurrentClientCertDetails": { "subject": true, "dns": true, "uri": true }, "upgradeConfigs": [ { "upgradeType": "websocket" } ], "normalizePath": true } } ], "transportSocket": { "name": "envoy.transport_sockets.tls", "typedConfig": { "@type": "type.googleapis.com/envoy.api.v2.auth.DownstreamTlsContext", "commonTlsContext": { "tlsCertificateSdsSecretConfigs": [ { "name": "default", "sdsConfig": { "apiConfigSource": { "apiType": "GRPC", "grpcServices": [ { "envoyGrpc": { "clusterName": "sds-grpc" } } ] } } } ], "combinedValidationContext": { "defaultValidationContext": {}, "validationContextSdsSecretConfig": { "name": "ROOTCA", "sdsConfig": { "apiConfigSource": { "apiType": "GRPC", "grpcServices": [ { "envoyGrpc": { "clusterName": "sds-grpc" } } ] } } } }, "alpnProtocols": [ "h2", "http/1.1" ] }, "requireClientCertificate": true } }, "name": "10.244.2.155_9080" }, { "filterChainMatch": { "destinationPort": 9080, "prefixRanges": [ { "addressPrefix": "10.244.2.155", "prefixLen": 32 } ] }, "filters": [ { "name": "istio.metadata_exchange", "typedConfig": { "@type": "type.googleapis.com/udpa.type.v1.TypedStruct", "typeUrl": "type.googleapis.com/envoy.tcp.metadataexchange.config.MetadataExchange", "value": { "protocol": "istio-peer-exchange" } } }, { "name": "envoy.http_connection_manager", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager", "statPrefix": "inbound_10.244.2.155_9080", "routeConfig": { "name": "inbound|9080|http|productpage.istio-bookinfo.svc.cluster.local", "virtualHosts": [ { "name": "inbound|http|9080", "domains": [ "*" ], "routes": [ { "name": "default", "match": { "prefix": "/" }, "route": { "cluster": "inbound|9080|http|productpage.istio-bookinfo.svc.cluster.local", "timeout": "0s", "maxGrpcTimeout": "0s" }, "decorator": { "operation": "productpage.istio-bookinfo.svc.cluster.local:9080/*" } } ] } ], "validateClusters": false }, "httpFilters": [ { "name": "istio.metadata_exchange", "typedConfig": { "@type": "type.googleapis.com/udpa.type.v1.TypedStruct", "typeUrl": "type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm", "value": { "config": { "configuration": "{}\n", "vm_config": { "code": { "local": { "inline_string": "envoy.wasm.metadata_exchange" } }, "runtime": "envoy.wasm.runtime.null" } } } } }, { "name": "istio_authn", "typedConfig": { "@type": "type.googleapis.com/istio.envoy.config.filter.http.authn.v2alpha1.FilterConfig", "policy": { "peers": [ { "mtls": { "mode": "PERMISSIVE" } } ] } } }, { "name": "envoy.cors", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.http.cors.v2.Cors" } }, { "name": "envoy.fault", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.http.fault.v2.HTTPFault" } }, { "name": "istio.stats", "typedConfig": { "@type": "type.googleapis.com/udpa.type.v1.TypedStruct", "typeUrl": "type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm", "value": { "config": { "configuration": "{\n \"debug\": \"false\",\n \"stat_prefix\": \"istio\"\n}\n", "root_id": "stats_inbound", "vm_config": { "code": { "local": { "inline_string": "envoy.wasm.stats" } }, "runtime": "envoy.wasm.runtime.null", "vm_id": "stats_inbound" } } } } }, { "name": "envoy.router", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.http.router.v2.Router" } } ], "tracing": { "clientSampling": { "value": 100 }, "randomSampling": { "value": 100 }, "overallSampling": { "value": 100 } }, "serverName": "istio-envoy", "streamIdleTimeout": "0s", "accessLog": [ { "name": "envoy.file_access_log", "typedConfig": { "@type": "type.googleapis.com/envoy.config.accesslog.v2.FileAccessLog", "path": "/dev/stdout", "format": "[%START_TIME%] \"%REQ(:METHOD)% %REQ(X-ENVOY-ORIGINAL-PATH?:PATH)% %PROTOCOL%\" %RESPONSE_CODE% %RESPONSE_FLAGS% \"%DYNAMIC_METADATA(istio.mixer:status)%\" \"%UPSTREAM_TRANSPORT_FAILURE_REASON%\" %BYTES_RECEIVED% %BYTES_SENT% %DURATION% %RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)% \"%REQ(X-FORWARDED-FOR)%\" \"%REQ(USER-AGENT)%\" \"%REQ(X-REQUEST-ID)%\" \"%REQ(:AUTHORITY)%\" \"%UPSTREAM_HOST%\" %UPSTREAM_CLUSTER% %UPSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_REMOTE_ADDRESS% %REQUESTED_SERVER_NAME% %ROUTE_NAME%\n" } } ], "useRemoteAddress": false, "generateRequestId": true, "forwardClientCertDetails": "APPEND_FORWARD", "setCurrentClientCertDetails": { "subject": true, "dns": true, "uri": true }, "upgradeConfigs": [ { "upgradeType": "websocket" } ], "normalizePath": true } } ], "name": "10.244.2.155_9080" } ], "listenerFilters": [ { "name": "envoy.listener.original_dst", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.listener.original_dst.v2.OriginalDst" } }, { "name": "envoy.listener.tls_inspector", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.listener.tls_inspector.v2.TlsInspector" } }, { "name": "envoy.listener.http_inspector", "typedConfig": { "@type": "type.googleapis.com/envoy.config.filter.listener.http_inspector.v2.HttpInspector" } } ], "listenerFiltersTimeout": "1s", "continueOnListenerFiltersTimeout": true, "trafficDirection": "INBOUND" } ] |
文章评论