Skip to content

Instantly share code, notes, and snippets.

@turgayozgur
Last active November 27, 2019 18:59
Show Gist options
  • Save turgayozgur/4e5b8ef10d42f4c70bd6ff6790cbd009 to your computer and use it in GitHub Desktop.
Save turgayozgur/4e5b8ef10d42f4c70bd6ff6790cbd009 to your computer and use it in GitHub Desktop.
Envoy Proxy Dynamic Configurations
# Here is the cluster definition. You can declare more than one cluster on there.
# Cluster definitions points to endpoint definitions(eds.yaml).
# Also, at this level you can configure a circuit breaker for the cluster.
version_info: "0"
resources:
- '@type': type.googleapis.com/envoy.api.v2.Cluster
name: "EnvoyNetCore"
connect_timeout: 5s
lb_policy: ROUND_ROBIN
type: EDS
eds_cluster_config:
service_name: "EnvoyNetCore"
eds_config:
path: /etc/envoy/eds.yaml
# The last part of the configuration file is eds.yaml.
# This file contains the address and port values to call any endpoint we want to include for the cluster.
# You can define only one resource item at this point but more than one endpoints can be provided.
version_info: "0"
resources:
- '@type': type.googleapis.com/envoy.api.v2.ClusterLoadAssignment
cluster_name: ""
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 127.0.0.1 # The address of the application.
port_value: "8181" # Listening port from the application.
# node section is required.
# Envoy exposes a local administration interface that can be used to query and modify different aspects of the server.
# There is two dynamic config file provided. One for cluster definitions and the another one for listerners.
node:
id: id_1
cluster: main
admin:
access_log_path: /tmp/envoy_admin_access.log
address:
socket_address:
address: 0.0.0.0
port_value: "9901"
dynamic_resources:
cds_config:
path: /etc/envoy/cds.yaml
lds_config:
path: /etc/envoy/lds.yaml
# The listener_0 configuration
# Listens to port 80 and redirects all the requests to the route definiton(/etc/envoy/rds.yaml) named local_route.
version_info: "0"
resources:
- '@type': type.googleapis.com/envoy.api.v2.Listener
name: listener_0
address:
socket_address:
address: 0.0.0.0
port_value: "80"
filter_chains:
- filters:
- name: envoy.http_connection_manager
config:
stat_prefix: ingress_http
codec_type: AUTO
server_name: default
rds:
route_config_name: local_route
config_source:
path: /etc/envoy/rds.yaml
http_filters:
- name: envoy.router
# The route definition that pass all the requests to the cluster named EnvoyNetCore.
# The cluster known from the envoy.yaml file. (/etc/envoy/cds.yaml)
version_info: "0"
resources:
- '@type': type.googleapis.com/envoy.api.v2.RouteConfiguration
name: local_route # route_config_name on the lds.yaml
virtual_hosts:
- name: "EnvoyNetCore"
domains:
- "envoynetcore.com"
routes:
- match:
prefix: /
route:
cluster: "EnvoyNetCore" # cluster name on the cds.yaml we want to point to.
timeout: 60s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment