Kind cluster
2 minute read
Any Kubernetes cluster can be used in order to deploy the manifests.yaml file generated by score-k8s generate.
This page show you how you can configure a Kind cluster with either the Gateway API or an Ingress controller if you want to expose your workloads via a dns/route.
Create a Kind cluster
cat <<EOF | kind create cluster --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
extraPortMappings:
- containerPort: 31000
hostPort: 80
protocol: TCP
EOF
From there, you can configure in this cluster:
- Either a Gateway API
- Or an Ingress controller
Configure a Gateway API
Install the latest Gateway API CRDs in the Kind cluster:
GATEWAY_API_VERSION=$(curl -sL https://api.github.com/repos/kubernetes-sigs/gateway-api/releases/latest | jq -r .tag_name)
kubectl apply \
-f https://github.com/kubernetes-sigs/gateway-api/releases/download/${GATEWAY_API_VERSION}/standard-install.yaml
Install the Nginx Gateway API implementation in the Kind cluster:
helm upgrade ngf oci://ghcr.io/nginxinc/charts/nginx-gateway-fabric \
--install \
--create-namespace \
-n nginx-gateway \
--set service.type=NodePort \
--set-json 'service.ports=[{"port":80,"nodePort":31000}]'
Install a default Gateway in the default Namespace in the Kind cluster:
kubectl apply -f - <<EOF
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: default
spec:
gatewayClassName: nginx
listeners:
- name: http
port: 80
protocol: HTTP
allowedRoutes:
namespaces:
from: All
EOF
From here, by using the default provisioners with score-k8s init, you will be able to use this Gateway by using the route object which will generate an HTTPRoute link to this Gateway.
This default HTTPRoute is assuming that Gateway is in the same Namespace, but if you want to use the cross-Namespace Gateway approach, you will need to use this community provisioner instead:
score-k8s init \
--provisioners https://raw.githubusercontent.com/score-spec/community-provisioners/refs/heads/main/route/score-k8s/10-shared-gateway-httproute.provisioners.yaml
Configure an Ingress controller
Install the Nginx Ingress controller in the Kind cluster:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
From here, you can now use this community provisioner to generate an Ingress for the route resource instead of the default HTTPRoute:
score-k8s init \
--provisioners https://raw.githubusercontent.com/score-spec/community-provisioners/refs/heads/main/route/score-k8s/10-ingress-route.provisioners.yaml
Next steps
- Explore more examples: Check out more examples to dive into further use cases and experiment with different configurations.
- Join the Score community: Connect with fellow Score developers on our CNCF Slack channel or start find your way to contribute to Score.