Skip to content

Commit 025f5b4

Browse files
author
Antonio Robson de Paula
committed
[WIP]Support KiND cluster for local dev environment #800
1 parent bcb4a2b commit 025f5b4

File tree

1 file changed

+111
-0
lines changed
  • daprdocs/content/en/operations/hosting/kubernetes/cluster

1 file changed

+111
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
type: docs
3+
title: "Setup a KiND cluster"
4+
linkTitle: "KiND"
5+
weight: 1100
6+
description: >
7+
How to setup Dapr on a KiND cluster.
8+
---
9+
10+
# Set up a KiND cluster
11+
12+
## Prerequisites
13+
14+
- [Docker](https://docs.docker.com/install/)
15+
- [kubectl](https://kubernetes.io/docs/tasks/tools/)
16+
17+
> Note: For Windows, enable Virtualization in BIOS and [install Hyper-V](https://docs.microsoft.com/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v)
18+
19+
## Install and configure KiND
20+
21+
Make sure you follow one of the [Installation](https://kind.sigs.k8s.io/docs/user/quick-start) options for KiND.
22+
23+
In case you are using Docker Desktop, double-check that you have performed the recommended [settings](https://kind.sigs.k8s.io/docs/user/quick-start#settings-for-docker-desktop) (4 CPUs and 8 GiB of RAM available to Docker Engine).
24+
25+
## Configure and create the KiND cluster
26+
27+
1. Create a file named `kind-cluster-config.yaml`, and paste the following:
28+
```yaml
29+
kind: Cluster
30+
apiVersion: kind.x-k8s.io/v1alpha4
31+
nodes:
32+
- role: control-plane
33+
kubeadmConfigPatches:
34+
- |
35+
kind: InitConfiguration
36+
nodeRegistration:
37+
kubeletExtraArgs:
38+
node-labels: "ingress-ready=true"
39+
extraPortMappings:
40+
- containerPort: 80
41+
hostPort: 8081
42+
protocol: TCP
43+
- containerPort: 443
44+
hostPort: 8443
45+
protocol: TCP
46+
- role: worker
47+
- role: worker
48+
```
49+
50+
This is going to request KiND to spin up a kubernetes cluster comprised of a control plane and two worker nodes. It also allows for future setup of ingresses and exposes container ports to the host machine.
51+
52+
2. Run the `kind create cluster` providing the cluster configuration file:
53+
54+
```bash
55+
kind create cluster --config kind-cluster-config.yaml
56+
```
57+
58+
Wait until the cluster is created, the output should look like this:
59+
60+
```md
61+
Creating cluster "kind" ...
62+
✓ Ensuring node image (kindest/node:v1.21.1) 🖼
63+
✓ Preparing nodes 📦 📦 📦
64+
✓ Writing configuration 📜
65+
✓ Starting control-plane 🕹️
66+
✓ Installing CNI 🔌
67+
✓ Installing StorageClass 💾
68+
✓ Joining worker nodes 🚜
69+
Set kubectl context to "kind-kind"
70+
You can now use your cluster with:
71+
72+
kubectl cluster-info --context kind-kind
73+
74+
Thanks for using kind! 😊
75+
```
76+
77+
## Dapr
78+
79+
1. Initialize Dapr:
80+
```bash
81+
dapr init --kubernetes
82+
```
83+
84+
Once Dapr finishes initializing its core components are ready to be used on the cluster.
85+
86+
To verify the status of these components run:
87+
```bash
88+
dapr status -k
89+
```
90+
the output should look like this:
91+
92+
```md
93+
NAME NAMESPACE HEALTHY STATUS REPLICAS VERSION AGE CREATED
94+
dapr-sentry dapr-system True Running 1 1.5.1 53s 2021-12-10 09:27.17
95+
dapr-operator dapr-system True Running 1 1.5.1 53s 2021-12-10 09:27.17
96+
dapr-sidecar-injector dapr-system True Running 1 1.5.1 53s 2021-12-10 09:27.17
97+
dapr-dashboard dapr-system True Running 1 0.9.0 53s 2021-12-10 09:27.17
98+
dapr-placement-server dapr-system True Running 1 1.5.1 52s 2021-12-10 09:27.18
99+
```
100+
101+
2. Forward a port to [Dapr dashboard](https://docs.dapr.io/reference/cli/dapr-dashboard/):
102+
103+
```bash
104+
dapr dashboard -k -p 9999
105+
```
106+
107+
So that you can validate that the setup finished successfully by navigating to [http://localhost:9999](http://localhost:9999).
108+
109+
## Next steps
110+
- [Try out a Dapr quickstart]({{< ref quickstarts.md >}})
111+

0 commit comments

Comments
 (0)