envoy-v3-api.yaml 4.11 KB
apiVersion: v1
kind: ConfigMap
metadata:
  name: envoy-cm-17
data:
  envoy-yml: |-
    admin:
      access_log_path: /tmp/admin_access.log
      address:
        socket_address:
          protocol: TCP
          address: 127.0.0.1
          port_value: 9901
    static_resources:
      listeners:
      - name: listener_0
        address:
          socket_address:
            protocol: TCP
            address: 0.0.0.0
            port_value: 10000
        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:
                name: local_route
                virtual_hosts:
                - name: local_service
                  domains: ["*"]
                  routes:
                  - match:
                      prefix: "/"
                    route:
                      cluster: service_httpbin
                    typed_per_filter_config:
                      envoy.filters.http.dynamic_forward_proxy:
                        "@type": type.googleapis.com/envoy.extensions.filters.http.dynamic_forward_proxy.v3.PerRouteConfig
                        host_rewrite_literal: httpbin.org
                  rate_limits:
                    - stage: 0
                      actions:
                        - {destination_cluster: {}}
              http_filters:
                - name: envoy.filters.http.ratelimit
                  typed_config:
                    "@type": type.googleapis.com/envoy.extensions.filters.http.ratelimit.v3.RateLimit
                    domain: foo
                    request_type: external
                    failure_mode_deny: false
                    stage: 0
                    rate_limit_service:
                      grpc_service:
                        envoy_grpc:
                          cluster_name: rate_limit_cluster
                        timeout: 2s
                      transport_api_version: V3
                - name: envoy.filters.http.router
                  typed_config:
                    "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
      clusters:
      - name: service_httpbin
        connect_timeout: 0.5s
        type: LOGICAL_DNS
        # Comment out the following line to test on v6 networks
        dns_lookup_family: V4_ONLY
        lb_policy: ROUND_ROBIN
        load_assignment:
          cluster_name: service_httpbin
          endpoints:
          - lb_endpoints:
            - endpoint:
                address:
                  socket_address:
                    address: httpbin.org
                    port_value: 80
      - name: rate_limit_cluster
        type: STRICT_DNS
        connect_timeout: 10s
        lb_policy: ROUND_ROBIN
        http2_protocol_options: {}
        load_assignment:
          cluster_name: rate_limit_cluster
          endpoints:
          - lb_endpoints:
            - endpoint:
                address:
                  socket_address:
                    address: sentinel-rls-service
                    port_value: 10245
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: envoy-deployment-basic-17
  labels:
    app: envoy-17
spec:
  replicas: 1
  selector:
    matchLabels:
      app: envoy-17
  template:
    metadata:
      labels:
        app: envoy-17
    spec:
      containers:
        - name: envoy
          image: envoyproxy/envoy:v1.17.3
          ports:
            - containerPort: 10000
          command: ["envoy"]
          args: ["-c", "/tmp/envoy/envoy.yaml"]
          volumeMounts:
            - name: envoy-config
              mountPath: /tmp/envoy
      volumes:
        - name: envoy-config
          configMap:
            name: envoy-cm-17
            items:
              - key: envoy-yml
                path: envoy.yaml
---
apiVersion: v1
kind: Service
metadata:
  name: envoy-service-17
  labels:
    name: envoy-service-17
spec:
  type: NodePort
  ports:
    - port: 10000
      targetPort: 10000
      protocol: TCP
  selector:
    app: envoy-17