Development document update and formatting
This commit is contained in:
parent
bedb8fd29a
commit
027fb31b3a
|
|
@ -10,41 +10,41 @@ Cluster API Provider RKE2 is compliant with the `clusterctl` contract, which mea
|
||||||
## Management Cluster
|
## Management Cluster
|
||||||
|
|
||||||
In order to use this provider, you need to have a management cluster available to you and have your current KUBECONFIG context set to talk to that cluster. If you do not have a cluster available to you, you can create a `kind` cluster. These are the steps needed to achieve that:
|
In order to use this provider, you need to have a management cluster available to you and have your current KUBECONFIG context set to talk to that cluster. If you do not have a cluster available to you, you can create a `kind` cluster. These are the steps needed to achieve that:
|
||||||
1. Ensure kind is installed (https://kind.sigs.k8s.io/docs/user/quick-start/#installation)
|
1. Ensure [kind is installed](https://kind.sigs.k8s.io/docs/user/quick-start/#installation).
|
||||||
2. Create a special `kind` configuration file if you intend to use the Docker infrastructure provider:
|
2. Create a special `kind` configuration file if you intend to use the Docker infrastructure provider:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cat > kind-cluster-with-extramounts.yaml <<EOF
|
cat > kind-cluster-with-extramounts.yaml <<EOF
|
||||||
kind: Cluster
|
kind: Cluster
|
||||||
apiVersion: kind.x-k8s.io/v1alpha4
|
apiVersion: kind.x-k8s.io/v1alpha4
|
||||||
name: capi-test
|
name: capi-test
|
||||||
nodes:
|
nodes:
|
||||||
- role: control-plane
|
- role: control-plane
|
||||||
extraMounts:
|
extraMounts:
|
||||||
- hostPath: /var/run/docker.sock
|
- hostPath: /var/run/docker.sock
|
||||||
containerPath: /var/run/docker.sock
|
containerPath: /var/run/docker.sock
|
||||||
EOF
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Run the following command to create a local kind cluster:
|
3. Run the following command to create a local kind cluster:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
kind create cluster --config kind-cluster-with-extramounts.yaml
|
kind create cluster --config kind-cluster-with-extramounts.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Check your newly created `kind` cluster :
|
4. Check your newly created `kind` cluster :
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
kubectl cluster-info
|
kubectl cluster-info
|
||||||
```
|
```
|
||||||
and get a similar result to this:
|
and get a similar result to this:
|
||||||
|
|
||||||
```
|
```
|
||||||
Kubernetes control plane is running at https://127.0.0.1:40819
|
Kubernetes control plane is running at https://127.0.0.1:40819
|
||||||
CoreDNS is running at https://127.0.0.1:40819/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
|
CoreDNS is running at https://127.0.0.1:40819/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
|
||||||
|
|
||||||
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
|
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
|
||||||
```
|
```
|
||||||
|
|
||||||
## Setting up clusterctl
|
## Setting up clusterctl
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,71 +4,81 @@ The following instructions are for development purposes.
|
||||||
|
|
||||||
1. Clone the [Cluster API Repo](https://github.com/kubernetes-sigs/cluster-api) into the **GOPATH**
|
1. Clone the [Cluster API Repo](https://github.com/kubernetes-sigs/cluster-api) into the **GOPATH**
|
||||||
|
|
||||||
> **Why clone into the GOPATH?** There have been historic issues with code generation tools when they are run outside the go path
|
> **Why clone into the GOPATH?** There have been historic issues with code generation tools when they are run outside the go path
|
||||||
|
|
||||||
2. Fork the [Cluster API Provider RKE2](https://github.com/rancher/cluster-api-provider-rke2) repo
|
2. Fork the [Cluster API Provider RKE2](https://github.com/rancher/cluster-api-provider-rke2) repo
|
||||||
3. Clone your new repo into the **GOPATH** (i.e. `~/go/src/github.com/yourname/cluster-api-provider-rke2`)
|
3. Clone your new repo into the **GOPATH** (i.e. `~/go/src/github.com/yourname/cluster-api-provider-rke2`)
|
||||||
4. Ensure **Tilt** and **kind** are installed
|
4. Ensure **Tilt** and **kind** are installed
|
||||||
5. Create a `tilt-settings.json` file in the root of your forked/cloned `cluster-api` directory.
|
5. Create a `tilt-settings.json` file in the root of the directory where you cloned the Cluster API repo in step 1.
|
||||||
6. Add the following contents to the file (replace "yourname" with your github account name):
|
6. Add the following contents to the file (replace `/path/to/clone/of/` with appropriate file path and "yourname" with
|
||||||
|
your github account name):
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"default_registry": "ghcr.io/yourname",
|
"default_registry": "ghcr.io/yourname",
|
||||||
"provider_repos": ["../../github.com/yourname/cluster-api-provider-rke2"],
|
"provider_repos": ["/path/to/clone/of/github.com/yourname/cluster-api-provider-rke2"],
|
||||||
"enable_providers": ["docker", "rke2-bootstrap", "rke2-control-plane"],
|
"enable_providers": ["docker", "rke2-bootstrap", "rke2-control-plane"],
|
||||||
"kustomize_substitutions": {
|
"kustomize_substitutions": {
|
||||||
"EXP_MACHINE_POOL": "true",
|
"EXP_MACHINE_POOL": "true",
|
||||||
"EXP_CLUSTER_RESOURCE_SET": "true"
|
"EXP_CLUSTER_RESOURCE_SET": "true"
|
||||||
},
|
|
||||||
"extra_args": {
|
|
||||||
"rke2-bootstrap": ["--v=4"],
|
|
||||||
"rke2-control-plane": ["--v=4"],
|
|
||||||
"core": ["--v=4"]
|
|
||||||
},
|
|
||||||
"debug": {
|
|
||||||
"rke2-bootstrap": {
|
|
||||||
"continue": true,
|
|
||||||
"port": 30001
|
|
||||||
},
|
},
|
||||||
"rke2-control-plane": {
|
"extra_args": {
|
||||||
"continue": true,
|
"rke2-bootstrap": ["--v=4"],
|
||||||
"port": 30002
|
"rke2-control-plane": ["--v=4"],
|
||||||
|
"core": ["--v=4"]
|
||||||
|
},
|
||||||
|
"debug": {
|
||||||
|
"rke2-bootstrap": {
|
||||||
|
"continue": true,
|
||||||
|
"port": 30001
|
||||||
|
},
|
||||||
|
"rke2-control-plane": {
|
||||||
|
"continue": true,
|
||||||
|
"port": 30002
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
```
|
||||||
```
|
|
||||||
|
|
||||||
> NOTE: Until this [bug](https://github.com/kubernetes-sigs/cluster-api/pull/7482) merged in CAPI you will have to make the changes locally to your clone of CAPI.
|
|
||||||
|
|
||||||
7. Open another terminal (or pane) and go to the `cluster-api` directory.
|
7. Open another terminal (or pane) and go to the `cluster-api` directory.
|
||||||
8. Run the following to create a configuration for kind:
|
8. Run the following to create a configuration for kind:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cat > kind-cluster-with-extramounts.yaml <<EOF
|
cat > kind-cluster-with-extramounts.yaml <<EOF
|
||||||
kind: Cluster
|
kind: Cluster
|
||||||
apiVersion: kind.x-k8s.io/v1alpha4
|
apiVersion: kind.x-k8s.io/v1alpha4
|
||||||
name: capi-test
|
name: capi-test
|
||||||
nodes:
|
nodes:
|
||||||
- role: control-plane
|
- role: control-plane
|
||||||
extraMounts:
|
extraMounts:
|
||||||
- hostPath: /var/run/docker.sock
|
- hostPath: /var/run/docker.sock
|
||||||
containerPath: /var/run/docker.sock
|
containerPath: /var/run/docker.sock
|
||||||
EOF
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
> NOTE: if you are using Docker Desktop v4.13 or above then you will you will encounter issues from here. Until a permanent solution is found its recommended you use v4.12
|
> NOTE: if you are using Docker Desktop v4.13 or above then you will encounter issues from here. Until
|
||||||
|
> a permanent solution is found its recommended you use v4.12
|
||||||
|
|
||||||
9. Run the following command to create a local kind cluster:
|
9. Run the following command to create a local kind cluster:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
kind create cluster --config kind-cluster-with-extramounts.yaml
|
kind create cluster --config kind-cluster-with-extramounts.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
10. Now start tilt by running the following:
|
10. Now start tilt by running the following command in the directory where you cloned Cluster API repo in step 1:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
tilt up
|
tilt up
|
||||||
```
|
```
|
||||||
|
|
||||||
11. Press the **space** key to see the Tilt web ui and check that everything goes green.
|
11. Press the **space** key to see the Tilt web ui and check that everything goes green.
|
||||||
|
|
||||||
|
### Troubleshooting
|
||||||
|
|
||||||
|
Doing `tilt up` should install a bunch of resources in the underlying kind cluster. If you don't see anything there,
|
||||||
|
run `tilt logs` in a separate terminal without stopping the `tilt up` command that you originally started.
|
||||||
|
|
||||||
|
#### Common Issues
|
||||||
|
|
||||||
|
1. Make sure you run the `kind` and `tilt` commands mentioned above from correct directory.
|
||||||
|
2. A `go mod vendor` might be required in your clone of CAPI repo. `tilt logs` should make this obvious.
|
||||||
Loading…
Reference in New Issue