Skip to content

Commit d46cff7

Browse files
Update Readme docs (#435)
Signed-off-by: Prajyot-Parab <[email protected]>
1 parent c77e15a commit d46cff7

File tree

4 files changed

+228
-3
lines changed

4 files changed

+228
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ The [Cluster API](https://github.com/kubernetes-sigs/cluster-api) brings declara
154154
IBMVPC_IMAGE_ID=r134-ea84bbec-7986-4ff5-8489-d9ec34611dd4 \
155155
IBMVPC_PROFILE=bx2-4x16 \
156156
IBMVPC_SSHKEY_ID=r134-2a82b725-e570-43d3-8b23-9539e8641944 \
157-
clusterctl config cluster ibm-vpc-0 --kubernetes-version v1.19.9 \
157+
clusterctl generate cluster ibm-vpc-0 --kubernetes-version v1.19.9 \
158158
--target-namespace default \
159159
--control-plane-machine-count=1 \
160160
--worker-machine-count=2 \
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,167 @@
11
# Creating a cluster
2+
3+
### Provision local boostrap management cluster:
4+
5+
1. Create simple, local bootstrap cluster with a control-plane and worker node
6+
7+
Using [kind](https://kind.sigs.k8s.io/docs/user/quick-start/):
8+
9+
```console
10+
~ kind create cluster --name my-bootstrap --config bootstrap.yaml
11+
```
12+
13+
Example bootstrap.yaml:
14+
```yaml
15+
kind: Cluster
16+
apiVersion: kind.x-k8s.io/v1alpha4
17+
nodes:
18+
- role: control-plane
19+
- role: worker
20+
```
21+
22+
Make sure the nodes are in `Ready` state before moving on.
23+
24+
```console
25+
~ kubectl get nodes
26+
NAME STATUS ROLES AGE VERSION
27+
my-bootstrap-control-plane Ready control-plane,master 46h v1.20.2
28+
my-bootstrap-worker Ready <none> 46h v1.20.2
29+
```
30+
31+
2. Set workload cluster environment variables
32+
33+
Make sure these value reflects your API Key for PowerVS environment in IBM Cloud.
34+
35+
```console
36+
export IBMCLOUD_API_KEY=<YOUR_API_KEY>
37+
```
38+
39+
3. Initialize local bootstrap cluter as a management cluster
40+
41+
This cluster will be used to provision a workload cluster in IBM Cloud.
42+
43+
```console
44+
~ clusterctl init --infrastructure ibmcloud:<TAG>
45+
```
46+
47+
Output:
48+
```console
49+
Fetching providers
50+
Installing cert-manager Version="v1.5.3"
51+
Waiting for cert-manager to be available...
52+
Installing Provider="cluster-api" Version="v0.4.4" TargetNamespace="capi-system"
53+
Installing Provider="bootstrap-kubeadm" Version="v0.4.4" TargetNamespace="capi-kubeadm-bootstrap-system"
54+
Installing Provider="control-plane-kubeadm" Version="v0.4.4" TargetNamespace="capi-kubeadm-control-plane-system"
55+
Installing Provider="infrastructure-ibmcloud" Version="v0.1.0-alpha.2" TargetNamespace="capi-ibmcloud-system"
56+
57+
Your management cluster has been initialized successfully!
58+
59+
You can now create your first workload cluster by running the following:
60+
61+
clusterctl generate cluster [name] --kubernetes-version [version] | kubectl apply -f -
62+
```
63+
64+
4. Create PowerVS network port
65+
66+
```console
67+
~ pvsadm create port --description "capi-port" --network <NETWORK_NAME> --instance-id <SERVICE_INSTANCE_ID>
68+
```
69+
70+
Output:
71+
```console
72+
I1125 15:24:20.581757 1548881 port.go:89] Successfully created a port, id: ac18ef17-8517-40e3-889d-4f246e9bd17e
73+
+---------------------+------------+------+-----------------+-------------------+--------------------------------------+-------------+--------+
74+
| DESCRIPTION | EXTERNALIP | HREF | IPADDRESS | MACADDRESS | PORTID | PVMINSTANCE | STATUS |
75+
+---------------------+------------+------+-----------------+-------------------+--------------------------------------+-------------+--------+
76+
| capi-port | | | 192.168.151.125 | fa:16:3e:34:2c:ef | 7eff02b5-040c-4934-957a-18209e65eca4 | | DOWN |
77+
+---------------------+------------+------+-----------------+-------------------+--------------------------------------+-------------+--------+
78+
```
79+
80+
```console
81+
~ pvsadm get ports --instance-id <SERVICE_INSTANCE_ID> --network <NETWORK_NAME>
82+
```
83+
84+
Output:
85+
```console
86+
+-------------------+-----------------+-----------------+-------------------+--------------------------------------+--------+
87+
| DESCRIPTION | EXTERNALIP | IPADDRESS | MACADDRESS | PORTID | STATUS |
88+
+-------------------+-----------------+-----------------+-------------------+--------------------------------------+--------+
89+
| capi-port | 158.175.162.125 | 192.168.151.125 | fa:16:3e:34:2c:ef | 7eff02b5-040c-4934-957a-18209e65eca4 | DOWN |
90+
+-------------------+-----------------+-----------------+-------------------+--------------------------------------+--------+
91+
```
92+
93+
4. Provision workload cluster in IBM Cloud PowerVS
94+
95+
You can use clusterctl to render the yaml through templates.
96+
97+
**Note:** the `IBMPOWERVS_IMAGE_ID` value below should reflect the ID of the custom qcow2 image, the `kubernetes-version` value below should reflect the kubernetes version of the custom qcow2 image.
98+
99+
```console
100+
IBMPOWERVS_SSHKEY_NAME="my-pub-key" \
101+
IBMPOWERVS_VIP="192.168.151.22" \
102+
IBMPOWERVS_VIP_EXTERNAL="158.175.162.22" \
103+
IBMPOWERVS_VIP_CIDR="29" \
104+
IBMPOWERVS_IMAGE_ID="505f57d8-1143-4a99-b67f-7e82d73342bf" \
105+
IBMPOWERVS_SERVICE_INSTANCE_ID="7845d372-d4e1-46b8-91fc-41051c984601" \
106+
IBMPOWERVS_NETWORK_ID="0ad342f5-f461-414a-a870-e2f2a2b7fa0c" \
107+
clusterctl generate cluster ibm-powervs-1 --kubernetes-version v1.22.4 \
108+
--target-namespace default \
109+
--control-plane-machine-count=3 \
110+
--worker-machine-count=1 \
111+
--from ./cluster-template-powervs.yaml | kubectl apply -f -
112+
```
113+
114+
Output:
115+
```console
116+
cluster.cluster.x-k8s.io/ibm-powervs-1 created
117+
ibmpowervscluster.infrastructure.cluster.x-k8s.io/ibm-powervs-1 created
118+
kubeadmcontrolplane.controlplane.cluster.x-k8s.io/ibm-powervs-1-control-plane created
119+
ibmpowervsmachinetemplate.infrastructure.cluster.x-k8s.io/ibm-powervs-1-control-plane created
120+
machinedeployment.cluster.x-k8s.io/ibm-powervs-1-md-0 created
121+
ibmpowervsmachinetemplate.infrastructure.cluster.x-k8s.io/ibm-powervs-1-md-0 created
122+
kubeadmconfigtemplate.bootstrap.cluster.x-k8s.io/ibm-powervs-1-md-0 created
123+
```
124+
125+
5. Deploy Container Network Interface (CNI)
126+
127+
Example: calico
128+
```console
129+
kubectl apply -f https://docs.projectcalico.org/v3.15/manifests/calico.yaml
130+
```
131+
132+
133+
6. Check the state of the provisioned cluster and machine objects within the local management cluster
134+
135+
Clusters
136+
```console
137+
~ kubectl get clusters
138+
NAME PHASE
139+
ibm-powervs-1 Provisioned
140+
```
141+
142+
Kubeadm Control Plane
143+
```console
144+
~ kubectl get kubeadmcontrolplane
145+
NAME INITIALIZED API SERVER AVAILABLE VERSION REPLICAS READY UPDATED UNAVAILABLE
146+
ibm-powervs-1-control-plane true true v1.22.4 1 1 1
147+
```
148+
149+
Machines
150+
```console
151+
~ kubectl get machines
152+
ibm-powervs-1-control-plane-vzz47 ibmpowervs://ibm-powervs-1/ibm-powervs-1-control-plane-rg6xv Running v1.22.4
153+
ibm-powervs-1-md-0-5444cfcbcd-6gg5z ibmpowervs://ibm-powervs-1/ibm-powervs-1-md-0-dbxb7 Running v1.22.4
154+
ibm-powervs-1-md-0-5444cfcbcd-7kr9x ibmpowervs://ibm-powervs-1/ibm-powervs-1-md-0-k7blr Running v1.22.4
155+
```
156+
157+
7. Check the state of the newly provisioned cluster within IBM Cloud
158+
159+
```console
160+
~ clusterctl get kubeconfig ibm-powervs-1 > ~/.kube/ibm-powervs-1
161+
~ export KUBECONFIG=~/.kube/ibm-powervs-1
162+
~ kubectl get nodes
163+
NAME STATUS ROLES AGE VERSION
164+
ibm-powervs-1-control-plane-rg6xv Ready master 41h v1.22.4
165+
ibm-powervs-1-md-0-4dc5c Ready <none> 41h v1.22.4
166+
ibm-powervs-1-md-0-dbxb7 Ready <none> 20h v1.22.4
167+
```
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,60 @@
11
# Prerequisites
2+
3+
1. Install `kubectl` (see [here](https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-binary-with-curl-on-linux)). Because `kustomize` was included into `kubectl` and it's used by `cluster-api-provider-ibmcloud` in generating yaml files, so version `1.14.0+` of `kubectl` is required, see [integrate kustomize into kubectl](https://github.com/kubernetes/enhancements/issues/633) for more info.
4+
2. You can use either VM, container or existing Kubernetes cluster act as the bootstrap cluster.
5+
- If you want to use container, install [kind](https://github.com/kubernetes-sigs/kind#installation-and-usage). This is preferred.
6+
- If you want to use VM, install [minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/), version 0.30.0 or greater.
7+
- If you want to use existing Kubernetes cluster, prepare your kubeconfig.
8+
3. Install a [driver](https://github.com/kubernetes/minikube/blob/master/docs/drivers.md) **if you are using minikube**. For Linux, we recommend kvm2. For MacOS, we recommend VirtualBox.
9+
4. An appropriately configured [Go development environment](https://golang.org/doc/install)
10+
5. Install `clusterctl` tool (see [here](https://cluster-api.sigs.k8s.io/user/quick-start.html#install-clusterctl))
11+
6. Install `pvsadm` tool (see [here](https://github.com/ppc64le-cloud/pvsadm#installation))
12+
6. Install `ibmcloud` tool (see [here](https://github.com/IBM-Cloud/ibm-cloud-cli-release#downloads))
13+
14+
15+
## **PowerVS Prerequisites**
16+
17+
### Create an IBM Cloud account.
18+
19+
If you don’t already have one, you need a paid IBM Cloud account to create your Power Systems Virtual Server instance.
20+
To create an account, go to: [cloud.ibm.com](https://cloud.ibm.com).
21+
22+
### Create an IBM Cloud account API key
23+
24+
Please refer to the following [documentation](https://cloud.ibm.com/docs/account?topic=account-userapikey) to create an API key.
25+
26+
27+
### Create Power Systems Virtual Server Service Instance
28+
29+
After you have an active IBM Cloud account, you can create a Power Systems Virtual Server service. To do so, perform the following steps:
30+
31+
1. ***TO-DO***
32+
33+
## Create Network
34+
35+
A public network is required for your kubernetes cluster. Perform the following steps to create a public network for the Power Systems Virtual Server service instance created in the previous step.
36+
37+
1. Create Public Network
38+
39+
```console
40+
~ ibmcloud pi network-create-public capi-test --dns-servers "8.8.8.8 9.9.9.9"
41+
```
42+
43+
Output:
44+
```console
45+
Network capi-test created.
46+
47+
ID fea9ac26-693d-402b-b22f-aa3d90ed0a31
48+
Name capi-test
49+
Type pub-vlan
50+
VLAN 2008
51+
CIDR Block 192.168.150.96/29
52+
IP Range [192.168.150.98 192.168.150.102]
53+
Public IP Range [158.175.161.98 158.175.161.102]
54+
Gateway 192.168.150.97
55+
DNS 8.8.8.8, 9.9.9.9
56+
```
57+
58+
## Build workload cluster image:
59+
60+
1. ***TO-DO***

templates/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ IBMVPC_NAME=ibm-vpc-1 \
1111
IBMVPC_IMAGE_ID=r134-ea84bbec-7986-4ff5-8489-d9ec34611dd4 \
1212
IBMVPC_PROFILE=bx2-4x16 \
1313
IBMVPC_SSHKEY_ID=r134-2a82b725-e570-43d3-8b23-9539e8641944 \
14-
clusterctl config cluster ibm-vpc-1 --kubernetes-version v1.14.3 \
14+
clusterctl generate cluster ibm-vpc-1 --kubernetes-version v1.14.3 \
1515
--target-namespace default \
1616
--control-plane-machine-count=1 \
1717
--worker-machine-count=2 \
@@ -28,7 +28,7 @@ IBMPOWERVS_VIP_CIDR="29" \
2828
IBMPOWERVS_IMAGE_ID="fb2f75d1-1157-40b9-af2f-5459685ca089" \
2929
IBMPOWERVS_SERVICE_INSTANCE_ID="e449d86e-c3a0-4c07-959e-8557fdf55482" \
3030
IBMPOWERVS_NETWORK_ID="07ba61c2-64a4-42ce-911e-a3b3656eab7c" \
31-
clusterctl config cluster ibm-powervs-1 --kubernetes-version v1.21.2 \
31+
clusterctl generate cluster ibm-powervs-1 --kubernetes-version v1.21.2 \
3232
--target-namespace default \
3333
--control-plane-machine-count=3 \
3434
--worker-machine-count=1 \

0 commit comments

Comments
 (0)