部署与安装
envoy的部署方式基本上是三种,最常用的docker形式,其次可以根据不用操作系统进行命令行安装(centos使用yum),最后可以自己手动进行编译
因为想单纯探索envoy的使用形式,则直接进行使用第二种方式进行安装
yum安装方式:
sudo yum install yum-utils
sudo rpm --import 'https://rpm.dl.getenvoy.io/public/gpg.CF716AF503183491.key'
curl -sL 'https://rpm.dl.getenvoy.io/public/config.rpm.txt?distro=el&codename=7' > /tmp/tetrate-getenvoy-rpm-stable.repo
sudo yum-config-manager --add-repo '/tmp/tetrate-getenvoy-rpm-stable.repo'
sudo yum makecache --disablerepo='*' --enablerepo='tetrate-getenvoy-rpm-stable'
sudo yum install getenvoy-envoy
这里在安装时候centos6时会遇到很多的错误,可能是这样安装的envoy版本比极高.
如果是centos6可能会遇到的问题:
yum 会报错 problem making ssl connection Trying other mirror
解决方式(方案二):https://www.jianshu.com/p/0e6c60f1e942
然后会报 Package: getenvoy-envoy Requires: libc.so.6
所以这里建议在centos7上进行yum的安装,以上问题均不会出现
# envoy --version
envoy version: d362e791eb9e4efa8d87f6d878740e72dc8330ac/1.18.2/clean-getenvoy-76c310e-envoy/RELEASE/BoringSSL
# ll /bin/envoy
/bin/envoy -> /opt/getenvoy/bin/envoy
获取demo 配置文件
wget https://www.envoyproxy.io/docs/envoy/latest/_downloads/92dcb9714fb6bc288d042029b34c0de4/envoy-demo.yaml
修改配置文件
因为各项配置仍然在使用探索中,这里简单配置了一个http服务
admin:
access_log_path: /tmp/admin_access.log
address:
socket_address: { address: 0.0.0.0, port_value: 9901 }
static_resources:
listeners:
- name: listener_0
address:
socket_address:
address: 0.0.0.0
port_value: 80
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
stat_prefix: ingress_http
access_log:
- name: envoy.access_loggers.stdout
typed_config:
"@type": type.googleapis.com/envoy.extensions.access_loggers.stream.v3.StdoutAccessLog
http_filters:
- name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: ["*"]
routes:
- match:
prefix: "/"
route:
host_rewrite_literal: www.testffffffff.com
cluster: service_envoyproxy_io
clusters:
- name: service_envoyproxy_io
connect_timeout: 0.25s
type: LOGICAL_DNS
# Comment out the following line to test on v6 networks
dns_lookup_family: V4_ONLY
load_assignment:
cluster_name: service_envoyproxy_io
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 10.218.57.37
port_value: 8090
admin 属于envoy管理后台的配置
static_resources 就是静态资源,配置各种filter,下面挂载一个虚拟主机(virtual_hosts)的概念
虚拟主机会绑定一个集群(clusters),集群下就是真实的服务节点(endpoint)
服务启动
envoy -c envoy-demo.yaml
测试
端口
服务验证
后续会尝试更复杂的配置,以及工程化相关的内容
标签:http,name,部署,envoy,getenvoy,笔记,yum,address From: https://www.cnblogs.com/zhaosc-haha/p/16898694.html