Skip to content

Instantly share code, notes, and snippets.

@akhenakh
Last active October 30, 2023 16:24
Show Gist options
  • Save akhenakh/2f0a735cf395eb0c2fc224b263896d07 to your computer and use it in GitHub Desktop.
Save akhenakh/2f0a735cf395eb0c2fc224b263896d07 to your computer and use it in GitHub Desktop.
Quick setup to experiment with Envoy Gateway on a Mac

Note to quickly deploy Envoy Gateway for experiment on a Mac using Colima (or a Linux)

Mac Requirement (M1/M2)

# clean up colima install BEWARE!! older version of colima sometimes are failing
rm -rf ~/.colima ~/.lima

# start colima with kubernetes option and disable Traefik
colima start --kubernetes --kubernetes-disable=traefik  --arch aarch64 --vm-type=vz --vz-rosetta --cpu 2 --memory 4

Installation

# install using yaml
kubectl apply -f https://github.com/envoyproxy/gateway/releases/download/v0.6.0-rc.1/install.yaml -n envoy-gateway-system

# or install using helm
helm install eg oci://docker.io/envoyproxy/gateway-helm --version v0.6.0-rc.1 -n envoy-gateway-system --create-namespace

Quickstart Example

apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
  name: eg
spec:
  controllerName: gateway.envoyproxy.io/gatewayclass-controller
---
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
  name: eg
spec:
  gatewayClassName: eg
  listeners:
    - name: http
      protocol: HTTP
      port: 80
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: backend
---
apiVersion: v1
kind: Service
metadata:
  name: backend
  labels:
    app: backend
    service: backend
spec:
  ports:
    - name: http
      port: 3000
      targetPort: 3000
  selector:
    app: backend
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend
spec:
  replicas: 1
  selector:
    matchLabels:
      app: backend
      version: v1
  template:
    metadata:
      labels:
        app: backend
        version: v1
    spec:
      serviceAccountName: backend
      containers:
        - image: gcr.io/k8s-staging-ingressconformance/echoserver:v20221109-7ee2f3e
          imagePullPolicy: IfNotPresent
          name: backend
          ports:
            - containerPort: 3000
          env:
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: backend
spec:
  parentRefs:
    - name: eg
  hostnames:
    - "www.example.com"
  rules:
    - backendRefs:
        - group: ""
          kind: Service
          name: backend
          port: 3000
          weight: 1
      matches:
        - path:
            type: PathPrefix
            value: /

Create example gw

kubectl apply -f https://github.com/envoyproxy/gateway/releases/download/v0.6.0-rc.1/quickstart.yaml -n default

Access using Servicelb

# service lb is opening 80 by default
curl --verbose --header "Host: www.example.com" http://localhost/get
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment