如何在 Ubuntu 18 上安装 Envoy 代理

今天我们将演示如何安装 特使代理 在 Ubuntu 上。

Envoy 是为单一服务和应用程序设计的高性能 C++ 分布式代理,也是为大型微服务“服务网格”架构设计的通信总线和“通用数据平面”。 基于对 NGINX、HAProxy、硬件负载均衡器和云负载均衡器等解决方案的学习,Envoy 与每个应用程序一起运行,并通过以与平台无关的方式提供通用功能来抽象网络。

envoyproxy.io/

Envoy 主要用于在基于网格的环境中使用 NginX 和 HAProxy 的微服务和系统。 它包括热重启、弹性、可观察性以及高级负载平衡系统的选项。 Envoy Proxy 适用于所有应用程序和网络,无论平台如何都提供标准化功能。 Envoy 也适用于分布式架构,使用内置的高可用性概念,公开动态 API 进行配置。 传统上,代理是使用静态配置文件配置的。 然而,Envoy 支持静态配置模型,允许通过 gRPC/protobuf API 设置配置。 这使得大规模管理变得更容易,并且还允许 Envoy 在具有瞬态服务的环境中更好地工作。

使用 Envoy 代理的优势

以下是使用 Envoy 代理的一些优点:

  • 我们不需要将 Envoy 嵌入到应用程序的架构中,因为它在服务器上自主工作。
  • Envoy 可以在最小尺寸的服务器上使用,因为它只需要少量的 RAM 即可运行。 Envoy 还可以与任何编程语言或框架结合使用。
  • Envoy 代理支持 HTTP/1.1 和 HTTP/2,以及 gRPC。
  • 它还支持高级负载平衡功能,包括自动重试、开路、全局速度限制和查询影子。
  • 此外,Envoy 为详细的配置管理提供了强大的 API。
  • 最后,Envoy 提供第 7 层流量监控、对分布式跟踪的内置支持以及 mongodb、dynamodb 和许多其他应用程序的可观察性。

安装

让我们开始安装。 首先,我们需要更新我们的操作系统和服务器软件,以确保我们完全升级到最新版本。

root@host:~# apt -y update && apt -y upgrade
Hit:1 https://by.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 https://by.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:3 https://by.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:4 https://security.ubuntu.com/ubuntu bionic-security InRelease
Reading package lists... Done                                  
Building dependency tree   	
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree   	
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  efibootmgr fonts-liberation2 fonts-opensymbol gir1.2-geocodeglib-1.0
  gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gir1.2-gudev-1.0
  gir1.2-udisks-2.0 grilo-plugins-0.3-base gstreamer1.0-gtk3
  libboost-date-time1.65.1 libboost-filesystem1.65.1 libboost-iostreams1.65.1
  libboost-locale1.65.1 libcdr-0.1-1 libclucene-contribs1v5
  libclucene-core1v5 libcmis-0.5-5v5 libcolamd2 libdazzle-1.0-0
  libe-book-0.1-1 libedataserverui-1.2-2 libeot0 libepubgen-0.1-1
  libetonyek-0.1-1 libevent-2.1-6 libexiv2-14 libfreerdp-client2-2
  libfreerdp2-2 libfwup1 libgc1c2 libgee-0.8-2 libgexiv2-2 libgom-1.0-0
  libgpgmepp6 libgpod-common libgpod4 liblangtag-common liblangtag1
  liblirc-client0 libllvm8 liblua5.3-0 libmediaart-2.0-0 libmspub-0.1-1
  libodfgen-0.1-1 libqqwing2v5 libraw16 librevenge-0.0-0 libsgutils2-2
  libssh-4 libsuitesparseconfig5 libvncclient1 libwayland-egl1-mesa
  libwinpr2-2 libxapian30 libxmlsec1 libxmlsec1-nss lp-solve
  media-player-info python3-mako python3-markupsafe syslinux syslinux-common
  syslinux-legacy usb-creator-common
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@host:~#

注意:我们强烈建议您在此步骤之后重新启动服务器。

重启后,我们将安装 Envoy 运行所需的底层依赖项。

root@host:~# apt-get install -y pt-transport-https a-certificates curl gnupg-agent software-properties-common

Reading package lists... Done
Building dependency tree   	
Reading state information... Done
ca-certificates is already the newest version (20180409).
ca-certificates set to manually installed.
software-properties-common is already the newest version (0.96.24.32.12).
software-properties-common set to manually installed.
The following packages were automatically installed and are no longer required:
  efibootmgr fonts-liberation2 fonts-opensymbol gir1.2-geocodeglib-1.0
  gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gir1.2-gudev-1.0
  gir1.2-udisks-2.0 grilo-plugins-0.3-base gstreamer1.0-gtk3
  libboost-date-time1.65.1 libboost-filesystem1.65.1 libboost-iostreams1.65.1
  libboost-locale1.65.1 libcdr-0.1-1 libclucene-contribs1v5
  libclucene-core1v5 libcmis-0.5-5v5 libcolamd2 libdazzle-1.0-0
  libe-book-0.1-1 libedataserverui-1.2-2 libeot0 libepubgen-0.1-1
  libetonyek-0.1-1 libevent-2.1-6 libexiv2-14 libfreerdp-client2-2
  libfreerdp2-2 libfwup1 libgc1c2 libgee-0.8-2 libgexiv2-2 libgom-1.0-0
  libgpgmepp6 libgpod-common libgpod4 liblangtag-common liblangtag1
  liblirc-client0 libllvm8 liblua5.3-0 libmediaart-2.0-0 libmspub-0.1-1
  libodfgen-0.1-1 libqqwing2v5 libraw16 librevenge-0.0-0 libsgutils2-2
  libssh-4 libsuitesparseconfig5 libvncclient1 libwayland-egl1-mesa
  libwinpr2-2 libxapian30 libxmlsec1 libxmlsec1-nss lp-solve
  media-player-info python3-mako python3-markupsafe syslinux syslinux-common
  syslinux-legacy usb-creator-common
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
  libcurl4
The following NEW packages will be installed:
  apt-transport-https curl gnupg-agent libcurl4
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 380 kB of archives.
After this operation, 1.234 kB of additional disk space will be used.
Get:1 https://by.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 apt-transport-https all 1.6.12 [1.692 B]
Get:2 https://by.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcurl4 amd64 7.58.0-2ubuntu3.8 [214 kB]
Get:3 https://by.archive.ubuntu.com/ubuntu bionic-updates/main amd64 curl amd64 7.58.0-2ubuntu3.8 [159 kB]
Get:4 https://by.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 gnupg-agent all 2.2.4-1ubuntu1.2 [4.880 B]
Fetched 380 kB in 0s (5.718 kB/s)   	
Selecting previously unselected package apt-transport-https.
(Reading database ... 172938 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_1.6.12_all.deb ...
Unpacking apt-transport-https (1.6.12) ...
Selecting previously unselected package libcurl4:amd64.
Preparing to unpack .../libcurl4_7.58.0-2ubuntu3.8_amd64.deb ...
Unpacking libcurl4:amd64 (7.58.0-2ubuntu3.8) ...
Selecting previously unselected package curl.
Preparing to unpack .../curl_7.58.0-2ubuntu3.8_amd64.deb ...
Unpacking curl (7.58.0-2ubuntu3.8) ...
Selecting previously unselected package gnupg-agent.
Preparing to unpack .../gnupg-agent_2.2.4-1ubuntu1.2_all.deb ...
Unpacking gnupg-agent (2.2.4-1ubuntu1.2) ...
Setting up apt-transport-https (1.6.12) ...
Setting up libcurl4:amd64 (7.58.0-2ubuntu3.8) ...
Setting up gnupg-agent (2.2.4-1ubuntu1.2) ...
Setting up curl (7.58.0-2ubuntu3.8) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
root@host:~#

接下来,我们要导入验证 apt 包完整性所需的 GPG 密钥。

root@host:~# curl -sL 'https://getenvoy.io/gpg' | apt-key add -
OK
root@host:~#

现在,我们要仔细检查指纹密钥以确保文件是真实的并且没有被以任何方式篡改。

root@host:~# apt-key fingerprint 6FF974DB
pub   rsa4096 2019-03-01 [SC]
  	5270 CEAC 57F6 3EBD 9EA9  005D 0253 D0B2 6FF9 74DB
uid       	[ unknown] GetEnvoy <get[email protected]>
sub   rsa4096 2019-03-01 [E]
 
root@host:~#

接下来,我们可以添加安装软件的 Envy 存储库。

root@host:~# add-apt-repository "deb [arch=amd64] https://dl.bintray.com/tetrate/getenvoy-deb $(lsb_release -cs) stable"

Hit:1 https://by.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 https://by.archive.ubuntu.com/ubuntu bionic-updates InRelease        	
Hit:3 https://by.archive.ubuntu.com/ubuntu bionic-backports InRelease      	
Hit:4 https://security.ubuntu.com/ubuntu bionic-security InRelease         	
Ign:5 https://dl.bintray.com/tetrate/getenvoy-deb bionic InRelease        	
Get:6 https://dl.bintray.com/tetrate/getenvoy-deb bionic Release [5.356 B]
Get:7 https://dl.bintray.com/tetrate/getenvoy-deb bionic Release.gpg [821 B]
Get:8 https://dl.bintray.com/tetrate/getenvoy-deb bionic/stable amd64 Packages [1.611 B]
Fetched 7.788 B in 1s (9.353 B/s)     
Reading package lists... Done
root@host:~#

现在,让我们更新可用的操作系统包,然后我们可以使用 apt-get 安装 Envy。

root@host:~# apt-get update

Hit:1 https://by.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 https://by.archive.ubuntu.com/ubuntu bionic-updates InRelease        	
Hit:3 https://by.archive.ubuntu.com/ubuntu bionic-backports InRelease      	
Hit:4 https://security.ubuntu.com/ubuntu bionic-security InRelease         	
Ign:5 https://dl.bintray.com/tetrate/getenvoy-deb bionic InRelease        	
Get:6 https://dl.bintray.com/tetrate/getenvoy-deb bionic Release [5.356 B]
Fetched 5.356 B in 1s (9.339 B/s)              	
Reading package lists... Done
root@host:~#

接下来,我们将开始实际的软件安装。

root@host:~# apt-get install -y getenvoy-envoy

Reading package lists... Done
Building dependency tree   	
Reading state information... Done
The following packages were automatically installed and are no longer required:
  efibootmgr fonts-liberation2 fonts-opensymbol gir1.2-geocodeglib-1.0
  gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gir1.2-gudev-1.0
  gir1.2-udisks-2.0 grilo-plugins-0.3-base gstreamer1.0-gtk3
  libboost-date-time1.65.1 libboost-filesystem1.65.1 libboost-iostreams1.65.1
  libboost-locale1.65.1 libcdr-0.1-1 libclucene-contribs1v5
  libclucene-core1v5 libcmis-0.5-5v5 libcolamd2 libdazzle-1.0-0
  libe-book-0.1-1 libedataserverui-1.2-2 libeot0 libepubgen-0.1-1
  libetonyek-0.1-1 libevent-2.1-6 libexiv2-14 libfreerdp-client2-2
  libfreerdp2-2 libfwup1 libgc1c2 libgee-0.8-2 libgexiv2-2 libgom-1.0-0
  libgpgmepp6 libgpod-common libgpod4 liblangtag-common liblangtag1
  liblirc-client0 libllvm8 liblua5.3-0 libmediaart-2.0-0 libmspub-0.1-1
  libodfgen-0.1-1 libqqwing2v5 libraw16 librevenge-0.0-0 libsgutils2-2
  libssh-4 libsuitesparseconfig5 libvncclient1 libwayland-egl1-mesa
  libwinpr2-2 libxapian30 libxmlsec1 libxmlsec1-nss lp-solve
  media-player-info python3-mako python3-markupsafe syslinux syslinux-common
  syslinux-legacy usb-creator-common
Use 'apt autoremove' to remove them.

The following NEW packages will be installed:
  getenvoy-envoy
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 8.343 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 https://dl.bintray.com/tetrate/getenvoy-deb bionic/stable amd64 getenvoy-envoy amd64 1.13.1.p0.gb67c140-1p58.g95766ea [8.343 kB]
Fetched 8.343 kB in 1s (6.186 kB/s)     	
Selecting previously unselected package getenvoy-envoy.
(Reading database ... 172959 files and directories currently installed.)
Preparing to unpack .../getenvoy-envoy_1.13.1.p0.gb67c140-1p58.g95766ea_amd64.deb ...
Unpacking getenvoy-envoy (1.13.1.p0.gb67c140-1p58.g95766ea) ...
Setting up getenvoy-envoy (1.13.1.p0.gb67c140-1p58.g95766ea) ...
root@host:~#

我们现在可以验证安装的 Envoy 的版本。

root@host:~# envoy --version
 
envoy  version: b67c14052c49890a7e3afe614d50979c346c024b/1.13.1/clean-getenvoy-95766ea-envoy/RELEASE/BoringSSL
 
root@host:~#

结论

今天我们已经了解了 Envoy Proxy 是什么、为什么需要它以及在哪里最好地使用它。 我们已经熟悉了如何安装它,以及应用什么命令。 进一步阅读 envoyproxy 配置设置 可以在他们的网站上找到。

您想了解有关此软件选项的更多信息以及它如何适合您的平台吗? 通过 800.580.4985 与我们知识渊博的解决方案团队联系,或打开 聊天 或与我们联系以了解更多关于我们可以最好地利用该软件的专用服务器选项的信息!