Skip to content

Commit e02f748

Browse files
(chore) : improving documentation
Signed-off-by: Archisman <[email protected]>
1 parent 84b7623 commit e02f748

File tree

6 files changed

+120
-30
lines changed

6 files changed

+120
-30
lines changed

README.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,31 @@ In a separate terminal window, use `make exec-container-dev` to execute into the
2020

2121
Once you're inside the container, use `make generate-sample-config-aws-dev` to generate a sample config file at [./outputs/kubeaid-bootstrap-script.config.yaml](./outputs/kubeaid-bootstrap-script.config.yaml), targetting the AWS cloud provider. Adjust the config file according to your needs.
2222

23-
Export your AWS credentials as environment variables and then run `make bootstrap-cluster-dev` to bootstrap the cluster!
23+
Export your AWS credentials as environment variables like such :
2424

25-
### Debugging
25+
```sh
26+
export AWS_REGION=""
27+
export AWS_ACCESS_KEY_ID=""
28+
export AWS_SECRET_ACCESS_KEY=""
29+
export AWS_SESSION_TOKEN=""
30+
```
2631

27-
- Check ClusterAPI related pod logs.
32+
Then run `make bootstrap-cluster-dev-aws` to bootstrap the cluster!
2833

29-
- SSH into the control-plane node. In case of AWS, you can view cloud-init logs stored at `/var/log/cloud-init-output.log`.
34+
> [!NOTE]
35+
> If the `clusterawsadm bootstrap iam create-cloudformation-stack` command errors out with this message :
36+
>
37+
> the IAM CloudFormation Stack create / update failed and it's currently in a `ROLLBACK_COMPLETE` state
38+
>
39+
> then that means maybe there are pre-existing IAM resources with overlapping name. Then first delete them manually from the AWS Console and then retry running the script. Filter the IAM roles and policies in the corresponding region with the keyword : `cluster` / `clusterapi`.
40+
41+
If cluster provisioning gets stuck, then debug by :
42+
43+
- checking logs of ClusterAPI related pod.
44+
45+
- SSHing into the control-plane node. You can view cloud-init output logs stored at `/var/log/cloud-init-output.log`.
46+
47+
If you want to delete the provisioned cluster, then execute : `make delete-provisioned-cluster-dev-aws`.
3048

3149
## TODOs
3250

cmd/kubeaid-bootstrap-script/cluster/bootstrap/aws.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import (
88
)
99

1010
var AWSCmd = &cobra.Command{
11-
Use: "aws",
11+
Use: "aws",
12+
Short: "Bootstrap a self-managed Kubernetes cluster in AWS",
1213
Run: func(cmd *cobra.Command, args []string) {
1314
core.BootstrapCluster(cmd.Context(), skipKubeAidConfigSetup, skipClusterctlMove, aws.NewAWSCloudProvider(), false)
1415
},

cmd/kubeaid-bootstrap-script/cluster/bootstrap/hetzner.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import (
88
)
99

1010
var HetznerCmd = &cobra.Command{
11-
Use: "hetzner",
11+
Use: "hetzner",
12+
Short: "Bootstrap a self-managed Kubernetes cluster in Hetzner (bare-metal)",
1213
Run: func(cmd *cobra.Command, args []string) {
1314
core.BootstrapCluster(cmd.Context(), skipKubeAidConfigSetup, skipClusterctlMove, hetzner.NewHetznerCloudProvider(), false)
1415
},

cmd/kubeaid-bootstrap-script/cluster/delete/delete.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import (
66
)
77

88
var DeleteCmd = &cobra.Command{
9-
Use: "delete",
9+
Use: "delete",
10+
Short: "Delete a provisioned cluster",
1011
Run: func(cmd *cobra.Command, args []string) {
1112
core.DeleteCluster(cmd.Context())
1213
},

config/config.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ type (
3737
APIServer APIServerConfig `yaml:"apiServer"`
3838
}
3939

40+
// REFER : https://github.com/kubernetes-sigs/cluster-api/blob/main/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml.
41+
//
42+
// NOTE : Generally, refer to the KubeadmControlPlane CRD instead of the corresponding GoLang
43+
// source types linked below.
44+
// There are some configuration options which appear in the corresponding GoLang source type,
45+
// but not in the CRD. If you set those fields, then they get removed by the Kubeadm
46+
// control-plane provider. This causes the capi-cluster ArgoCD App to always be in an
47+
// OutOfSync state, resulting to the KubeAid Bootstrap Script not making any progress!
4048
APIServerConfig struct {
4149
ExtraArgs map[string]string `yaml:"extraArgs" default:"{}"`
4250
ExtraVolumes []HostPathMountConfig `yaml:"extraVolumes" default:"[]"`
@@ -54,7 +62,7 @@ type (
5462
// Defaults to true.
5563
//
5664
// NOTE : If you want the mount to be read-only, then set this true.
57-
// Otherwise, omit setting this field. It gets removed by the kubeadm control-plane
65+
// Otherwise, omit setting this field. It gets removed by the Kubeadm control-plane
5866
// provider component, which results to the capi-cluster ArgoCD App always being in
5967
// OutOfSync state.
6068
ReadOnly bool `yaml:"readOnly,omitempty"`
Lines changed: 83 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,111 @@
1-
forks:
2-
kubeaidConfig: https://github.com/xxxxxxxxxx/kubeaid-config
3-
1+
# Git credentials used to authenticate against the Git platform you're using (Github / Gitlab etc.).
2+
# KubeAid Bootstrap Script will use these credentials to :
3+
#
4+
# (1) Clone the KubeAid and KubeAid config repositories.
5+
# (2) Create and push commits to a branch in the KubeAid config repository.
6+
#
7+
# So, make sure the Git password (token) you're using has permissions associated to do the above.
8+
#
9+
# Currently, we only support HTTPS authentication.
410
git:
511
username: xxxxxxxxxx
612
password: xxxxxxxxxx
713

14+
forks:
15+
# KubeAid repository URL (in HTTPs syntax).
16+
# Defaults to Obmondo's KubeAid repository.
17+
# kubeaid: https://github.com/Obmondo/KubeAid
18+
19+
# Your KubeAid config repository URL (in HTTPs syntax).
20+
kubeaidConfig: https://github.com/xxxxxxxxxx/kubeaid-config
21+
22+
# Kubernetes cluster and control-plane specific configurations.
823
cluster:
24+
25+
# Kubernetes cluster name.
926
name: kubeaid-demo-aws
27+
28+
# Kubernetes version to use.
29+
# NOTE : Make sure that the AMI you're using, is targetted towards this Kubernetes version.
1030
k8sVersion: v1.31.0
1131

32+
# Kubernetes API server specific configurations.
33+
# REFER : https://github.com/kubernetes-sigs/cluster-api/blob/main/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml.
34+
#
35+
# NOTE : Generally, refer to the KubeadmControlPlane CRD instead of the corresponding GoLang
36+
# source types linked below.
37+
# There are some configuration options which appear in the corresponding GoLang source type,
38+
# but not in the CRD. If you set those fields, then they get removed by the Kubeadm
39+
# control-plane provider. This causes the capi-cluster ArgoCD App to always be in an
40+
# OutOfSync state, resulting to the KubeAid Bootstrap Script not making any progress!
41+
# apiServer:
42+
#
43+
# extraArgs: {}
44+
#
45+
# # REFER : "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1".HostPathMount
46+
# #
47+
# # NOTE : If you want a mount to be read-only, then set extraVolume.readOnly to true.
48+
# # Otherwise, omit setting that field. It gets removed by the Kubeadm control-plane
49+
# # provider component, which results to the capi-cluster ArgoCD App always being in
50+
# # OutOfSync state.
51+
# extraVolumes: []
52+
#
53+
# # REFER : "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1".File
54+
# files: []
55+
56+
# Uncomment, if you just want audit-logging to be setup for you! KubeAid Bootstrap Script will set
57+
# necessary configuration options in cluster.apiServer.
58+
# enableAuditLogging: True
59+
1260
cloud:
61+
# AWS specific configurations.
1362
aws:
14-
region: us-east-1
63+
region: us-east-1
1564

65+
# AWS SSH Keypair name, which ClusterAPI components (Kubeadm bootstrap and control-plane
66+
# providers specifically) will use to SSH into the main cluster's master nodes.
1667
sshKeyName: kubeaid-demo
1768

18-
bastionEnabled: False
69+
# bastionEnabled: True
1970

2071
controlPlane:
21-
instanceType: t4g.medium
22-
ami:
23-
id: ami-xxxxxxxxxxxxxxxxx
24-
replicas: 1
72+
ami:
73+
id: ami-xxxxxxxxxxxxxxxxx
74+
instanceType: t4g.medium
75+
replicas: 1
2576

2677
nodeGroups:
2778
- name: primary
2879
ami:
29-
id: ami-xxxxxxxxxxxxxxxxx
80+
id: ami-xxxxxxxxxxxxxxxxx
3081
instanceType: t4g.medium
82+
83+
minSize: 0
3184
replicas: 1
85+
maxSize: 3
86+
3287
rootVolumeSize: 35
88+
89+
# AWS SSH Keypair name, which ClusterAPI components (Kubeadm bootstrap provider
90+
# specifically) will use to SSH into each node belonging to this node-group.
3391
sshKeyName: kubeaid-demo
3492

35-
# Label should meet one of the following criterias to propagate to Node :
36-
#
37-
# (1) Has node-role.kubernetes.io as prefix.
38-
# (2) Belongs to node-restriction.kubernetes.io domain.
39-
# (3) Belongs to node.cluster.x-k8s.io domain.
40-
#
41-
# REFER : https://cluster-api.sigs.k8s.io/developer/architecture/controllers/metadata-propagation#machine
42-
labels:
43-
node.cluster.x-k8s.io/nodegroup: primary
93+
# A label should meet one of the following criterias to propagate to each of the nodes :
94+
#
95+
# (1) Has node-role.kubernetes.io as prefix.
96+
# (2) Belongs to node-restriction.kubernetes.io domain.
97+
# (3) Belongs to node.cluster.x-k8s.io domain.
98+
#
99+
# REFER : https://cluster-api.sigs.k8s.io/developer/architecture/controllers/metadata-propagation#machine
100+
labels:
101+
node.cluster.x-k8s.io/nodegroup: primary
44102
node-role.kubernetes.io/bootstrapper: ""
45103

46-
taints: []
104+
# taints: []
47105

48-
disasterRecovery:
49-
veleroBackupsS3BucketName: kubeaid-demo-kubernetes-objects
106+
disasterRecovery:
107+
veleroBackupsS3BucketName: kubeaid-demo-kubernetes-objects
50108
sealedSecretsBackupS3BucketName: kubeaid-demo-sealed-secrets
109+
110+
# monitoring:
111+
# kubePrometheusVersion: v0.14.0

0 commit comments

Comments
 (0)