gateway2

command
v1.18.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

README

Gloo Gateway

Note, all commands should be run from the root of the gloo repo.

APIs

The Kubernetes Gateway API integration is defined in the api directory. For more information on how to add a new API or CRD, see the API README.

Quickstart

Prerequisites
Setup

To create the local test environment in kind, run:

./ci/kind/setup-kind.sh

This will create the kind cluster and build the docker images.

Next use helm to install the gateway control plane:

helm upgrade -i -n gloo-system gloo ./_test/gloo-1.0.0-ci1.tgz --create-namespace --set kubeGateway.enabled=true

To create a gateway, use the Gateway resource:

kubectl apply -f - <<EOF
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
  name: http
spec:
  gatewayClassName: gloo-gateway
  listeners:
  - allowedRoutes:
      namespaces:
        from: All
    name: http
    port: 8080
    protocol: HTTP
EOF

Apply a test application such as bookinfo:

kubectl create namespace bookinfo
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.20/samples/bookinfo/platform/kube/bookinfo.yaml -n bookinfo

Then create a corresponding HTTPRoute:

kubectl apply -f- <<EOF
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
  name: productpage
  namespace: bookinfo
  labels:
    example: productpage-route
spec:
  parentRefs:
    - name: http
      namespace: default
  hostnames:
    - "www.example.com"
  rules:
    - backendRefs:
        - name: productpage
          port: 9080
EOF
Testing

Expose the gateway that gets created via the Gateway resource:

kubectl port-forward deployment/gloo-proxy-http 8080:8080

Send some traffic through the gateway:

curl -I localhost:8080/productpage -H "host: www.example.com" -v

Istio Integration

This will create the kind cluster, build the docker images.

./ci/kind/setup-kind.sh

Next we need to install Istio in the cluster along with the bookinfo test application in the mesh:

./projects/gateway2/istio.sh

Next use helm to install the gateway control plane with istio integration enabled:

helm upgrade -i -n gloo-system gloo ./_test/gloo-1.0.0-ci1.tgz --create-namespace --set kubeGateway.enabled=true --set global.istioSDS.enabled=true

In order to enable automtls, set it to true in the settings:

settings:
  istioOptions:
    enableAutoMtls: true

Then expose the gateway that gets created via the Gateway resource:

kubectl port-forward deployment/gloo-proxy-http 8080:8080

Send some traffic through the gateway:

curl -I localhost:8080/productpage -H "host: www.example.com" -v

Test sending traffic to an application not in mtls STRICT mode:

kubectl apply -f- <<EOF
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
  name: reviews
  namespace: bookinfo
  labels:
    example: reviews-route
spec:
  parentRefs:
    - name: http
      namespace: default
  hostnames:
    - "reviews"
  rules:
    - backendRefs:
        - name: reviews
          port: 9080
EOF

Then send traffic to reviews:

curl -I localhost:8080/reviews/1 -H "host: reviews" -v

Test sending traffic to an application not in the mesh:

# Create non-mesh app (helloworld namespace is not labeled for istio injection)
kubectl create namespace helloworld
kubectl apply -f https://raw.githubusercontent.com/istio/istio/master/samples/helloworld/helloworld.yaml -n helloworld

Apply an HTTPRoute for helloworld:

kubectl apply -f- <<EOF
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
  name: helloworld
  namespace: helloworld
  labels:
    example: helloworld-route
spec:
  parentRefs:
    - name: http
      namespace: default
  hostnames:
    - "helloworld"
  rules:
    - backendRefs:
        - name: helloworld
          port: 5000
EOF

Send traffic to the non-mesh app:

curl -I localhost:8080/hello -H "host: helloworld" -v

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL