The following example explains how to obtain an API key that you can use to validate API calls to a target service proxied through Apigee Adapter for Envoy.
You can use an existing developer for testing, or create a new one as follows:
Follow the Product creation example provided below.
Field | Value | Description |
---|---|---|
Name | httpbin-product | The unique name of the API product. |
Display Name | httpbin product | The descriptive name you want to see in the UI or other display contexts. |
Access | Public | For the purpose of this example, Public is a good choice. |
httpbin.org
or httpbin.default.svc.cluster.local
with Kubernetes. /
for the path. For information about path options, see Configuring resource paths.For more information, see Managing API products.
The developer app contains the API key that is required to make API proxy calls through the adapter.
Name | httpbin-app |
Developer | Select the developer you created previously, or pick any developer you wish from the list. |
httpbin
service through the Apigee Adapter for Envoy. You can use a JWT token to make authenticated API proxy calls instead of using an API key. This section explains how to use the apigee-remote-service-cli token
command to create, inspect, and rotate JWT tokens. For an Apigee hybrid environment, you can use this command to create Kubernetes secret to hold the JWT(s).
JWT verification and authentication is handled by Envoy using its JWT Authentication Filter.
Once authenticated, the Envoy ext-authz
filter sends the request headers and JWT to apigee-remote-service-envoy
. It matches the JWT's api_product_list
and scope
claims against Apigee API Products to authorize it against the target of the request.
Apigee JWT Tokens can be created using the CLI:
apigee-remote-service-cli token create -c config.yaml --id $KEY --secret $SECRET
Or by using the standard OAuth token endpoint. Curl example:
curl https://org-env.apigee.net/remote-token/token -d '{"client_id":"myclientid","client_secret":"myclientsecret","grant_type":"client_credentials"}' -H "Content-type: application/json"
Once you have the token, you simply pass it to Envoy in the Authorization header. Example:
curl localhost:8080/httpbin/headers -i -H "Authorization:Bearer $TOKEN"
If Envoy rejects the token, you may see a message like:
Jwks remote fetch has failed
If so, ensure that your Envoy configuration contains a valid URI in the remote_jwks
section, that it's reachable by Envoy, and that you properly set the certificates when you installed the Apigee proxy. You should be able to call the URI directly with a GET call and receive a valid JSON response.
Example:
curl https://myorg-eval-test.apigee.net/remote-service/certs
Other messages from Envoy may look like:
These are from requirements in your Envoy configuration that you may need to modify.
You can use the CLI to inspect your token. Example
apigee-remote-service-cli -c config.yaml token inspect -f path/to/file
or
apigee-remote-service-cli -c config.yaml token inspect <<< $TOKEN
By default, Apigee Adapter for Envoy uses the remote-token
API proxy as an identity provider service to authenticate client applications and deliver JWT tokens based on the OAuth 2.0 client credentials grant type. In some cases, however, you may not be able to use the remote-token
proxy. If you must use an identity provider that is not the one provided by Apigee, you can configure the adapter to use another identity provider. For details on this non-Apigee identity provider use case and the required configuration, see this article on the Apigee Community: Using your own Identity Provider with the Apigee Envoy Adapter.
You can adjust the logging level on the $REMOTE_SERVICE_HOME/apigee-remote-service-envoy service. All logging is sent to stderr.
Element | Required | Description |
---|---|---|
-l, --log-level | Valid levels: debug, info, warn, error. | Adjusts the logging level. Default: info |
-j, --json-log | Emits log output as JSON records. |
Envoy provides logging. For more information, see the following Envoy documentation links:
A Kubernetes Secret deployed to the cluster contains credentials that the adapter needs to authenticate communication with the remote service proxy. This Secret requires a volume mount point, which is configurable. By default, the mount point is /policy-secret
. To change the mount point, follow these steps:
$REMOTE_SERVICE_HOME/apigee-remote-service-envoy --policy-secret '/new-mount_point_name
For example:
$REMOTE_SERVICE_HOME/apigee-remote-service-envoy --policy-secret '/my-mount-point
$CLI_HOME/samples/apigee-envoy-adapter.yaml
in an editor.volumeMounts: - mountPath: /config name: apigee-remote-service-envoy readOnly: true - mountPath: /opt/apigee/tls name: tls-volume readOnly: true - mountPath: /my-mount-point name: policy-secret readOnly: true
kubectl apply -f $REMOTE_SERVICE_HOME/samples/apigee-envoy-adapter.yaml
An HTTP proxy can be inserted by using the HTTP_PROXY and HTTPS_PROXY environment variables in the environment of the apigee-remote-service-envoy binary. When using these, the NO_PROXY environment variable can also be used to exclude specific hosts from being sent through the proxy.
HTTP_PROXY=http://[user]:[pass]@[proxy_ip]:[proxy_port] HTTPS_PROXY=http://[user]:[pass]@[proxy_ip]:[proxy_port] NO_PROXY=127.0.0.1,localhost
Remember that the proxy must be reachable from apigee-remote-service-envoy.
A Prometheus metrics endpoint is available at :5001/metrics
. You can configure this port number. See Configuration file.
The following links provide information on obtaining Envoy proxy analytics data:
The following links provide information on obtaining Envoy proxy analytics data:
Apigee Remote Service for Envoy sends request statistics to Apigee for analytics processing. Apigee reports these requests under the associated API Product name.
For information about Apigee analytics, see Analytics services overview.
You can now enable the adapter to service multiple environments in an Apigee organization. This feature allows you to use one Apigee Adapter for Envoy associated with one Apigee organization to service multiple environments. Before this change, one adapter was always tied to one Apigee environment.
To configure multiple environment support, change the value of tenant:env_name
to "*"
in the config.yaml
file. For example:
config.yaml
file in an editor.tenant.env_name
to "*"
. For example: apiVersion: v1 kind: ConfigMap metadata: name: apigee-remote-service-envoy namespace: apigee data: config.yaml: | tenant: remote_service_api: https://apitest.mydomain.net/remote-service org_name: my-org env_name: "*"" allow_unverified_ssl_cert: true analytics: collection_interval: 10s auth: jwt_provider_key: https://apitest.mydomain.net/remote-token/token
kubectl apply -f $CLI_HOME/config.yaml
When you configure multi-environment mode, you must also configure Envoy to send an appropriate environment value to the adapter by adding the following metadata in the virtual_hosts:routes
section of the envoy-config.yaml
file. For example:
envoy-config.yaml
file using the CLI. For example: $CLI_HOME/apigee-remote-service-cli samples create \ -t envoy-1.16 -c ./config.yaml --out myconfigs
envoy-config.yaml
).virtual_host
or routes
section of the file: typed_per_filter_config: envoy.filters.http.ext_authz: "@type": type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthzPerRoute check_settings: context_extensions: apigee_environment: test
The following example illustrates configuration for a virtual_host
with multiple routes defined, where each route sends traffic to a specific environment:
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 route_config: virtual_hosts: - name: default domains: "*" routes: - match: { prefix: /test } route: cluster: httpbin typed_per_filter_config: envoy.filters.http.ext_authz: "@type": type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthzPerRoute check_settings: context_extensions: apigee_environment: test - match: { prefix: /prod } route: cluster: httpbin typed_per_filter_config: envoy.filters.http.ext_authz: "@type": type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthzPerRoute check_settings: context_extensions: apigee_environment: prod
The Adapter supports passing Envoy metadata to Apigee's data capture feature, which sends data captured in variables that you specify to Apigee analytics for use in custom reports. This feature provides a capability that is similar to the Apigee Data Capture policy.
To use this feature:
envoy-config.yaml
file using the CLI. For example: $CLI_HOME/apigee-remote-service-cli samples create \ -t envoy-1.16 -c ./config.yaml --out myconfigs
envoy-config.yaml
).envoy.filters.http.apigee.datacapture
namespace. For example, you can use a Header to Metadata filter or a Lua filter. For more information on these filters, see Header-To-Metadata and Lua. The custom variable names must be formatted as dc.XXXXX
.
Header to Metadata filter example:
- name: envoy.filters.http.header_to_metadata typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.header_to_metadata.v3.Config request_rules: - header: "Host" on_header_present: metadata_namespace: envoy.filters.http.apigee.datacapture key: dc.host # host (without the prefix) also works type: STRING remove: false
Lua filter example:
- name: envoy.filters.http.lua typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua inline_code: | function envoy_on_request(request_handle) metadata = request_handle:streamInfo():dynamicMetadata() metadata:set("envoy.filters.http.apigee.datacapture", "dc.test", "A test string.") end
You can supply client-side TLS certificates in the tenant
section of the adapter's config.yaml
file to use mTLS between the adapter and the Apigee runtime. This change applies to all supported Apigee platforms. It also enables mTLS for analytics for the Apigee Edge for Private Cloud platform. For example:
tenant: tls: ca_file: path/ca.pem cert_file: path/cert.pem key_file: path/key.pem allow_unverified_ssl_cert: false
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-04-24 UTC.