From 473456625a0e5e0604c23700430ac082e0bc0c38 Mon Sep 17 00:00:00 2001 From: Michael Nairn Date: Tue, 21 Nov 2023 09:17:30 +0000 Subject: [PATCH 1/4] docs: TLS and DNS Policy user guides --- Makefile | 1 + doc/user-guides/gateway-dns.md | 224 +++++++++++++++++++++++++++++++++ doc/user-guides/gateway-tls.md | 209 ++++++++++++++++++++++++++++++ utils/kind-cluster.yaml | 7 +- 4 files changed, 440 insertions(+), 1 deletion(-) create mode 100644 doc/user-guides/gateway-dns.md create mode 100644 doc/user-guides/gateway-tls.md diff --git a/Makefile b/Makefile index 739321651..850bd0283 100644 --- a/Makefile +++ b/Makefile @@ -371,6 +371,7 @@ deploy-dependencies: kustomize dependencies-manifests ## Deploy dependencies to .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 .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..18aba46df --- /dev/null +++ b/doc/user-guides/gateway-dns.md @@ -0,0 +1,224 @@ +# 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 +``` + +Install metallb: +```shell +make install-metallb +``` + +Fetch the current kind networks subnet: +```shell +docker network inspect kind -f '{{ (index .IPAM.Config 0).Subnet }}' +``` +Response: +```shell +"172.18.0.0/16" +``` + +Create IPAddressPool within kind network(Fetched by the command above) e.g. 172.18.200 +```shell +kubectl -n metallb-system apply -f -< +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 +``` + +Install metallb: +```shell +make install-metallb +``` + +Fetch the current kind networks subnet: +```shell +docker network inspect kind -f '{{ (index .IPAM.Config 0).Subnet }}' +``` +Response: +```shell +"172.18.0.0/16" +``` + +Create IPAddressPool within kind network(Fetched by the command above) e.g. 172.18.200 +```shell +kubectl -n metallb-system 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 - < Date: Fri, 24 Nov 2023 12:20:46 +0000 Subject: [PATCH 2/4] 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. --- Makefile | 7 +++++++ doc/user-guides/gateway-dns.md | 5 +++++ doc/user-guides/gateway-tls.md | 7 ++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 850bd0283..32b2ab5f0 100644 --- a/Makefile +++ b/Makefile @@ -368,6 +368,13 @@ 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 - diff --git a/doc/user-guides/gateway-dns.md b/doc/user-guides/gateway-dns.md index 18aba46df..8748aec98 100644 --- a/doc/user-guides/gateway-dns.md +++ b/doc/user-guides/gateway-dns.md @@ -26,6 +26,11 @@ Setup the environment: make local-setup ``` +Deploy policy controller and install DNSPolicy CRD: +```shell +make deploy-policy-controller +``` + Install metallb: ```shell make install-metallb diff --git a/doc/user-guides/gateway-tls.md b/doc/user-guides/gateway-tls.md index 0a186f55e..aa577b671 100644 --- a/doc/user-guides/gateway-tls.md +++ b/doc/user-guides/gateway-tls.md @@ -25,6 +25,11 @@ Setup the environment: make local-setup ``` +Deploy policy controller and install TLSPolicy CRD: +```shell +make deploy-policy-controller +``` + Install metallb: ```shell make install-metallb @@ -64,7 +69,7 @@ kubectl create namespace my-gateways ### Create an ingress gateway -Create a gateway using your ROOT_DOMAIN as part of a listener hostname: +Create a gateway: ```sh kubectl -n my-gateways apply -f - < Date: Wed, 22 Nov 2023 17:35:56 +0000 Subject: [PATCH 3/4] Add script to generate MetalLB IPAddressPool for docker network. --- Makefile | 1 + doc/user-guides/gateway-dns.md | 27 ----------------------- doc/user-guides/gateway-tls.md | 29 +------------------------ utils/docker-network-ipaddresspool.sh | 31 +++++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 55 deletions(-) create mode 100755 utils/docker-network-ipaddresspool.sh diff --git a/Makefile b/Makefile index 32b2ab5f0..865691f59 100644 --- a/Makefile +++ b/Makefile @@ -379,6 +379,7 @@ undeploy-policy-controller: ## Undeploy policy-controller from the K8s cluster s 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 index 8748aec98..4b20e46dd 100644 --- a/doc/user-guides/gateway-dns.md +++ b/doc/user-guides/gateway-dns.md @@ -36,33 +36,6 @@ Install metallb: make install-metallb ``` -Fetch the current kind networks subnet: -```shell -docker network inspect kind -f '{{ (index .IPAM.Config 0).Subnet }}' -``` -Response: -```shell -"172.18.0.0/16" -``` - -Create IPAddressPool within kind network(Fetched by the command above) e.g. 172.18.200 -```shell -kubectl -n metallb-system apply -f -< Date: Fri, 24 Nov 2023 15:18:36 +0000 Subject: [PATCH 4/4] Change kind cluster ports 80 -> 9081, 443 -> 9444 --- utils/kind-cluster.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/kind-cluster.yaml b/utils/kind-cluster.yaml index 42f93e3e9..f1403b909 100644 --- a/utils/kind-cluster.yaml +++ b/utils/kind-cluster.yaml @@ -10,8 +10,8 @@ nodes: - containerPort: 30951 hostPort: 9443 - containerPort: 80 - hostPort: 8080 + hostPort: 9081 protocol: TCP - containerPort: 443 - hostPort: 8443 + hostPort: 9444 protocol: TCP