appendix-b

appendix B Advanced configurations for kind

 

This appendix shows you how to set up your Kubernetes in Docker (kind) cluster in a way that will allow you to follow along with some of the advanced configurations, such as with Gateway API, custom resource definitions (CRDs), and other networking configurations. The only prerequisites for these configurations are having Helm and Kustomize installed with your kubectl command-line tool.

B.1 Exposing a port in kind

As we have already created a kind cluster in appendix A, I will assume you already know how to create a config file. The following example creates a single-node kind cluster with a label applied to a node as well as port 80 exposed. We’ll create a config-ingress.yaml file, similar to how we created one in appendix A, but we’ll add a few extra lines. Create the cluster config file named config-ingress.yaml by copying and pasting the following into your terminal (for macOS and Linux only):

cat <<EOF | tee config-ingress.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  extraPortMappings:
  - containerPort: 80
    hostPort: 80
    listenAddress: "127.0.0.1"
  labels:
    ingress-ready: "true"

EOF

If you are a Windows user, use the following command instead:

echo "kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  extraPortMappings:
  - containerPort: 80
    hostPort: 80
    listenAddress: "127.0.0.1"
  labels:
    ingress-ready: "true" > .\config-ingress.yaml

B.2 Installing Gateway API