@@ -9,24 +9,17 @@ a `kind` cluster as the management cluster as well as the nested workload cluste
9
9
Please install the latest version of [ kind] ( https://kind.sigs.k8s.io/docs/user/quick-start/#installation )
10
10
and [ kubectl] ( https://kubernetes.io/docs/tasks/tools/ )
11
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
12
### Create ` kind ` cluster
20
13
21
- ``` shell
14
+ ``` console
22
15
kind create cluster --name=capn
23
16
```
24
17
25
18
### Clone CAPI and build ` clusterctl ` tool
26
19
27
20
As a Cluster API (CAPI) provider, CAPN needs the ` clusterctl ` binary to install and manage clusters.
28
21
29
- ``` shell
22
+ ``` console
30
23
git clone [email protected] :kubernetes-sigs/cluster-api.git
31
24
cd cluster-api
32
25
make clusterctl
@@ -36,7 +29,7 @@ make clusterctl
36
29
37
30
If you aren't familar with CAPI & ` clusterctl ` this command will deploy the core components, as well as the Nested components for infra providers and for control plane providers.
38
31
39
- ``` shell
32
+ ``` console
40
33
./bin/clusterctl init --core cluster-api:v0.4.0 --control-plane nested:v0.1.0 --infrastructure nested:v0.1.0
41
34
```
42
35
@@ -58,8 +51,8 @@ You can now create your first workload cluster by running the following:
58
51
```
59
52
60
53
and wait for all pods to be ` Running ` before proceed to next step:
61
- ```
62
- kubectl get pods --all-namespaces
54
+ ``` console
55
+ $ kubectl get pods --all-namespaces
63
56
NAMESPACE NAME READY STATUS RESTARTS AGE
64
57
capi-kubeadm-bootstrap-system capi-kubeadm-bootstrap-controller-manager-c59c94d6f-l8f4v 1/1 Running 0 4m45s
65
58
capi-system capi-controller-manager-6c555b545d-rtw8k 1/1 Running 0 4m46s
@@ -81,13 +74,13 @@ local-path-storage local-path-provisioner-78776bfc44-qcx49
81
74
82
75
### Set clustername (in our example, we set clustername to ` cluster-sample ` )
83
76
84
- ``` shell
77
+ ``` console
85
78
export CLUSTER_NAME=cluster-sample
86
79
```
87
80
88
81
### Generate custom resource (` Cluster ` , ` NestedCluster ` etc) and apply to our cluster
89
82
90
- ``` shell
83
+ ``` console
91
84
./bin/clusterctl generate cluster ${CLUSTER_NAME} --infrastructure=nested:v0.1.0 | kubectl apply -f -
92
85
```
93
86
@@ -96,7 +89,7 @@ export CLUSTER_NAME=cluster-sample
96
89
We will use the ` clusterctl ` command-line tool to generate the ` KUBECONFIG ` , which
97
90
will be used to access the nested controlplane later.
98
91
99
- ``` shell
92
+ ``` console
100
93
./bin/clusterctl get kubeconfig ${CLUSTER_NAME} > ../kubeconfig
101
94
```
102
95
@@ -106,16 +99,16 @@ Error: "cluster-sample-kubeconfig" not found in namespace "default": secrets "cl
106
99
```
107
100
108
101
Run following command and make sure the ` Ready ` is true before retry above command.
109
- ```
110
- kubectl get nestedcluster -w
102
+ ``` console
103
+ $ kubectl get nestedcluster -w
111
104
NAME READY AGE
112
105
cluster-sample true 26h
113
106
```
114
107
115
108
### Make sure ` cluster-sample ` related pods are running before proceed.
116
109
117
- ```
118
- kubectl get pods
110
+ ``` console
111
+ $ kubectl get pods
119
112
NAME READY STATUS RESTARTS AGE
120
113
cluster-sample-apiserver-0 1/1 Running 0 25h
121
114
cluster-sample-controller-manager-0 1/1 Running 0 25h
@@ -127,8 +120,8 @@ cluster-sample-etcd-0 1/1 Running 0 25h
127
120
To access the nested controlplane, in a separate shell, you will need
128
121
to ` port-forward ` the apiserver service.
129
122
130
- ``` shell
131
- kubectl port-forward svc/cluster-sample-apiserver 6443:6443
123
+ ``` console
124
+ $ kubectl port-forward svc/cluster-sample-apiserver 6443:6443
132
125
Forwarding from 127.0.0.1:6443 -> 6443
133
126
Forwarding from [::1]:6443 -> 6443
134
127
```
@@ -145,15 +138,15 @@ following line to `/etc/hosts`.
145
138
146
139
### Connect to the Cluster! :tada :
147
140
148
- ``` shell
149
- kubectl --kubeconfig kubeconfig get all -A
141
+ ``` console
142
+ $ kubectl --kubeconfig kubeconfig get all -A
150
143
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
151
144
default service/kubernetes ClusterIP 10.32.0.1 <none> 443/TCP 25h
152
145
153
146
```
154
147
155
148
### Clean Up
156
149
157
- ``` shell
150
+ ``` console
158
151
kind delete cluster --name=capn
159
152
```
0 commit comments