Skip to content
This repository was archived by the owner on Oct 28, 2024. It is now read-only.

Commit c774cf9

Browse files
add capn quick start
1 parent fefd213 commit c774cf9

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed

docs/README.md

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
## Quick Start
2+
3+
This tutorial introduces how to create a nested controlplane. CAPN should work with any standard
4+
Kubernetes cluster out of box, but for demo purposes, in this tutorial, we will use
5+
a `kind` cluster as the management cluster as well as the nested workload cluster.
6+
7+
### Prerequisites
8+
9+
Please install the latest version of [kind](https://kind.sigs.k8s.io/docs/user/quick-start/#installation)
10+
and [kubectl](https://kubernetes.io/docs/tasks/tools/)
11+
12+
### Clone CAPN
13+
14+
```shell
15+
git clone https://github.com/kubernetes-sigs/cluster-api-provider-nested
16+
cd cluster-api-provider-nested
17+
```
18+
19+
### Create `kind` cluster
20+
21+
```shell
22+
kind create cluster
23+
```
24+
25+
### Install `cert-manager`
26+
27+
Cert Manager is a soft dependency for the Cluster API components to enable mutating
28+
and validating webhooks to be auto deployed. For more detailed instructions
29+
go [Cert Manager Installion](https://cert-manager.io/docs/installation/kubernetes/#installing-with-regular-manifests).
30+
31+
```shell
32+
kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.3.1/cert-manager.yaml
33+
```
34+
35+
### Clone CAPI and Deploy Dev release
36+
37+
As a cluster API~(CAPI) provider, CAPN requires core components of CAPI to be setup.
38+
We need to deploy the unreleased version of CAPI for `v1alpha4` API support.
39+
40+
```shell
41+
git clone [email protected]:kubernetes-sigs/cluster-api.git
42+
cd cluster-api
43+
make release-manifests
44+
# change feature flags on core
45+
sed -i'' -e 's@- --feature-gates=.*@- --feature-gates=MachinePool=false,ClusterResourceSet=true@' out/core-components.yaml
46+
kubectl apply -f out/core-components.yaml
47+
cd ..
48+
```
49+
50+
### Create Docker Images, Manifests and Load Images
51+
52+
```shell
53+
export PULL_POLICY=Never
54+
export TAG=dev
55+
make docker-build release-manifests
56+
kind load docker-image gcr.io/cluster-api-nested-controller-amd64:dev
57+
kind load docker-image gcr.io/nested-controlplane-controller-amd64:dev
58+
```
59+
60+
### Deploy CAPN
61+
62+
Next, we will deploy the CAPN related CRDs and controllers.
63+
64+
```shell
65+
kubectl apply -f out/cluster-api-provider-nested-components.yaml
66+
```
67+
68+
### Apply Sample Cluster
69+
70+
```shell
71+
kubectl apply -f config/samples/
72+
```
73+
74+
### Get `KUBECONFIG`
75+
76+
We will use the `clusterctl` command-line tool to generate the `KUBECONFIG`, which
77+
will be used to access the nested controlplane later.
78+
79+
```shell
80+
cd cluster-api
81+
make clusterctl
82+
./bin/clusterctl get kubeconfig cluster-sample > ../kubeconfig
83+
cd ..
84+
```
85+
86+
### Port Forward
87+
88+
To access the nested controlplane, in a separate shell, you will need
89+
to `port-forward` the apiserver service.
90+
91+
```shell
92+
kubectl port-forward svc/cluster-sample-apiserver 6443:6443
93+
```
94+
95+
### Connect to Cluster
96+
97+
To use the `KUBECONFIG` created by `clusterctl` without modification, we first
98+
need to setup a host record for the apiserver service name, to do this we can
99+
define a custom hosts file by setting the `HOSTALIASES` env and append the
100+
IP-address-to-URL mapping to the hosts file.
101+
102+
```shell
103+
echo '127.0.0.1 localhost1' >> ~/.hosts
104+
export HOSTALIASES=~/.hosts
105+
```
106+
107+
### Connect to the Cluster! :tada:
108+
109+
```shell
110+
kubectl --kubeconfig kubeconfig get all -A
111+
```

0 commit comments

Comments
 (0)