From b736a7b202122a01a5b4fd0c6123c8396344b479 Mon Sep 17 00:00:00 2001 From: Michael Nairn Date: Tue, 28 Nov 2023 09:25:26 +0000 Subject: [PATCH] docs: TLS and DNS Policy user guides (#322) * docs: TLS and DNS Policy user guides * docs: Update after removal of policy-controller from bundle * Add deploy-policy-controller and undeploy-policy-controller, deploys/undeploys the policy-controller into/from the kuadrant-system namespace. * Update dns and tls guides with extra step to install policy-controller. * Add script to generate MetalLB IPAddressPool for docker network. * Change kind cluster ports 80 -> 9081, 443 -> 9444 --- Makefile | 9 ++ doc/user-guides/gateway-dns.md | 202 ++++++++++++++++++++++++++ doc/user-guides/gateway-tls.md | 187 ++++++++++++++++++++++++ utils/docker-network-ipaddresspool.sh | 31 ++++ utils/kind-cluster.yaml | 7 +- 5 files changed, 435 insertions(+), 1 deletion(-) create mode 100644 doc/user-guides/gateway-dns.md create mode 100644 doc/user-guides/gateway-tls.md create mode 100755 utils/docker-network-ipaddresspool.sh diff --git a/Makefile b/Makefile index 739321651..865691f59 100644 --- a/Makefile +++ b/Makefile @@ -368,9 +368,18 @@ deploy-dependencies: kustomize dependencies-manifests ## Deploy dependencies to $(KUSTOMIZE) build config/dependencies | kubectl apply -f - kubectl -n "$(KUADRANT_NAMESPACE)" wait --timeout=300s --for=condition=Available deployments --all +deploy-policy-controller: kustomize ## Deploy policy-controller to the K8s cluster specified in ~/.kube/config. + $(KUSTOMIZE) build config/policy-controller | kubectl apply -f - + kubectl -n "$(KUADRANT_NAMESPACE)" wait --timeout=300s --for=condition=Available deployments policy-controller + +undeploy-policy-controller: ## Undeploy policy-controller from the K8s cluster specified in ~/.kube/config. + $(KUSTOMIZE) build config/policy-controller | kubectl delete -f - + .PHONY: install-metallb install-metallb: $(KUSTOMIZE) ## Installs the metallb load balancer allowing use of an LoadBalancer type with a gateway $(KUSTOMIZE) build config/metallb | kubectl apply -f - + kubectl -n metallb-system wait --for=condition=ready pod --selector=app=metallb --timeout=60s + ./utils/docker-network-ipaddresspool.sh kind | kubectl apply -n metallb-system -f - .PHONY: uninstall-metallb uninstall-metallb: $(KUSTOMIZE) diff --git a/doc/user-guides/gateway-dns.md b/doc/user-guides/gateway-dns.md new file mode 100644 index 000000000..4b20e46dd --- /dev/null +++ b/doc/user-guides/gateway-dns.md @@ -0,0 +1,202 @@ +# Gateway DNS for Cluster Operators + +This user guide walks you through an example of how to configure DNS for all routes attached to an ingress gateway. + +
+ +## Requisites + +- [Docker](https://docker.io) +- [Rout53 Hosted Zone](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/CreatingHostedZone.html) + +### Setup + +This step uses tooling from the Kuadrant Operator component to create a containerized Kubernetes server locally using [Kind](https://kind.sigs.k8s.io), +where it installs Istio, Kubernetes Gateway API and Kuadrant itself. + +Clone the project: + +```shell +git clone https://github.com/Kuadrant/kuadrant-operator && cd kuadrant-operator +``` + +Setup the environment: + +```shell +make local-setup +``` + +Deploy policy controller and install DNSPolicy CRD: +```shell +make deploy-policy-controller +``` + +Install metallb: +```shell +make install-metallb +``` + +Create a namespace: +```shell +kubectl create namespace my-gateways +``` + +Export a root domain and hosted zone id: +```shell +export ROOT_DOMAIN= +export AWS_HOSTED_ZONE_ID= +``` + +> **Note:** ROOT_DOMAIN and AWS_HOSTED_ZONE_ID should be set to your AWS hosted zone *name* and *id* respectively. + +### Create a ManagedZone + +Create AWS credentials secret +```shell +export AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= + +kubectl -n my-gateways create secret generic aws-credentials \ + --type=kuadrant.io/aws \ + --from-literal=AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \ + --from-literal=AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY +``` + +Create a ManagedZone +```sh +kubectl -n my-gateways apply -f - < + +## Requisites + +- [Docker](https://docker.io) + +### Setup + +This step uses tooling from the Kuadrant Operator component to create a containerized Kubernetes server locally using [Kind](https://kind.sigs.k8s.io), +where it installs Istio, Kubernetes Gateway API, CertManager and Kuadrant itself. + +Clone the project: + +```shell +git clone https://github.com/Kuadrant/kuadrant-operator && cd kuadrant-operator +``` + +Setup the environment: + +```shell +make local-setup +``` + +Deploy policy controller and install TLSPolicy CRD: +```shell +make deploy-policy-controller +``` + +Install metallb: +```shell +make install-metallb +``` + +Create a namespace: +```shell +kubectl create namespace my-gateways +``` + +### Create an ingress gateway + +Create a gateway: +```sh +kubectl -n my-gateways apply -f - < **Note:** We are using a [self-signed](https://cert-manager.io/docs/configuration/selfsigned/) issuer here but any supported CerManager issuer or cluster issuer can be used. + +```shell +kubectl get issuer selfsigned-issuer -n my-gateways +``` +Response: +```shell +NAME READY AGE +selfsigned-issuer True 18s +``` + +Create a Kuadrant `TLSPolicy` to configure TLS: +```sh +kubectl apply -n my-gateways -f - <