envoy 测试试用

备注: 为了简单测试使用的是docker 镜像进行的测试
 
1.  Dockerfile  
FROM lyft/envoy:latest
RUN apt-get update
COPY envoy.json /etc/envoy.json
CMD /usr/local/bin/envoy -c /etc/envoy.json
 
2. envoy.json 
{
    "listeners": [{
        "address": "tcp://0.0.0.0:10000",
        "filters": [{
            "type": "read",
            "name": "http_connection_manager",
            "config": {
                "codec_type": "auto",
                "stat_prefix": "ingress_http",
                "route_config": {
                    "virtual_hosts": [{
                        "name": "local_service",
                        "domains": [
                            "*"
                        ],
                        "routes": [{
                            "timeout_ms": 0,
                            "prefix": "/",
                            "host_rewrite": "www.baidu.com",
                            "cluster": "service_baidu"
                        }]
                    }]
                },
                "filters": [{
                    "type": "decoder",
                    "name": "router",
                    "config": {}
                }]
            }
        }]
    }],
    "admin": {
        "access_log_path": "/tmp/admin_access.log",
        "address": "tcp://0.0.0.0:9901"
    },
    "cluster_manager": {
        "clusters": [{
            "name": "service_baidu",
            "connect_timeout_ms": 250,
            "type": "logical_dns",
            "lb_type": "round_robin",
            "hosts": [{
                "url": "tcp://baidu.com:443"
            }],
            "ssl_context": {
                "sni": "www.baidu.com"
            }
        }]
    }
}
 
 
   简单说明: 请求ip:10000  的地址重定向到baidu  管理界面为ip:9901
 
3. 测试效果(只演示管理界面)
 
4. 总结
功能还是比较强大的,结合容器进行开发,可以充分发挥云原生应用的价

5. 参考资料
https://envoyproxy.github.io/envoy/intro/what_is_envoy.html
https://envoyproxy.github.io/download
 

posted on 2017-09-26 10:37  荣锋亮  阅读(850)  评论(0编辑  收藏  举报

导航