Skip to content

Commit

Permalink
Add VPC Load Balancer template (#838)
Browse files Browse the repository at this point in the history
Signed-off-by: Prajyot-Parab <[email protected]>

Signed-off-by: Prajyot-Parab <[email protected]>
  • Loading branch information
Prajyot-Parab authored Sep 12, 2022
1 parent 416bed6 commit b278813
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- [Prerequisites](./topics/vpc/prerequisites.md)
- [Uploading an image](topics/vpc/uploading-an-image.md)
- [Creating a cluster](./topics/vpc/creating-a-cluster.md)
- [Creating a cluster with Load Balancer](./topics/vpc/load-balancer.md)
- [Power VS Cluster](./topics/powervs/index.md)
- [Prerequisites](./topics/powervs/prerequisites.md)
- [Creating a cluster](./topics/powervs/creating-a-cluster.md)
Expand Down
19 changes: 19 additions & 0 deletions docs/book/src/topics/vpc/load-balancer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Provision workload Cluster with Load Balancer in IBM Cloud VPC
### This feature is currently in experimental stage

### Deploy VPC cluster with Load Balancer

```
IBMVPC_REGION=us-south \
IBMVPC_ZONE=us-south-1 \
IBMVPC_RESOURCEGROUP=4f15679623607b855b1a27a67f20e1c7 \
IBMVPC_NAME=ibm-vpc-0 \
IBMVPC_IMAGE_ID=r134-ea84bbec-7986-4ff5-8489-d9ec34611dd4 \
IBMVPC_PROFILE=bx2-4x16 \
IBMVPC_SSHKEY_ID=r134-2a82b725-e570-43d3-8b23-9539e8641944 \
clusterctl generate cluster ibm-vpc-0 --kubernetes-version v1.22.0 \
--target-namespace default \
--control-plane-machine-count=3 \
--worker-machine-count=1 \
--flavor=load-balancer | kubectl apply -f -
```
144 changes: 144 additions & 0 deletions templates/cluster-template-load-balancer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
labels:
cluster.x-k8s.io/cluster-name: "${CLUSTER_NAME}"
name: "${CLUSTER_NAME}"
namespace: "${NAMESPACE}"
spec:
clusterNetwork:
pods:
cidrBlocks:
- ${POD_CIDR:="192.168.0.0/16"}
serviceDomain: ${SERVICE_DOMAIN:="cluster.local"}
services:
cidrBlocks:
- ${SERVICE_CIDR:="10.128.0.0/12"}
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: IBMVPCCluster
name: "${CLUSTER_NAME}"
namespace: "${NAMESPACE}"
controlPlaneRef:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlane
name: "${CLUSTER_NAME}-control-plane"
namespace: "${NAMESPACE}"
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: IBMVPCCluster
metadata:
labels:
cluster.x-k8s.io/cluster-name: "${CLUSTER_NAME}"
name: "${CLUSTER_NAME}"
spec:
region: "${IBMVPC_REGION}"
zone: "${IBMVPC_ZONE}"
resourceGroup: "${IBMVPC_RESOURCEGROUP}"
vpc: "${IBMVPC_NAME}"
controlPlaneLoadBalancer:
name: "${CLUSTER_NAME}-load-balancer"
---
kind: KubeadmControlPlane
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
metadata:
name: "${CLUSTER_NAME}-control-plane"
namespace: "${NAMESPACE}"
spec:
version: "${KUBERNETES_VERSION}"
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
machineTemplate:
infrastructureRef:
kind: IBMVPCMachineTemplate
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
name: "${CLUSTER_NAME}-control-plane"
namespace: "${NAMESPACE}"
kubeadmConfigSpec:
clusterConfiguration:
kubernetesVersion: ${KUBERNETES_VERSION}
controllerManager:
extraArgs: {enable-hostpath-provisioner: 'true'}
apiServer:
certSANs: [localhost, 127.0.0.1]
dns: {}
etcd: {}
networking: {}
scheduler: {}
initConfiguration:
nodeRegistration:
criSocket: /var/run/containerd/containerd.sock
kubeletExtraArgs:
cloud-provider: external
provider-id: ibmvpc://${CLUSTER_NAME}/'{{ v1.local_hostname }}'
eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%'
joinConfiguration:
discovery: {}
nodeRegistration:
criSocket: /var/run/containerd/containerd.sock
kubeletExtraArgs:
cloud-provider: external
provider-id: ibmvpc://${CLUSTER_NAME}/'{{ v1.local_hostname }}'
eviction-hard: 'nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%'
---
kind: IBMVPCMachineTemplate
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
metadata:
name: "${CLUSTER_NAME}-control-plane"
spec:
template:
spec:
image: "${IBMVPC_IMAGE_ID}"
zone: "${IBMVPC_ZONE}"
profile: "${IBMVPC_PROFILE}"
sshKeys:
- "${IBMVPC_SSHKEY_ID}"
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
name: "${CLUSTER_NAME}-md-0"
spec:
clusterName: "${CLUSTER_NAME}"
replicas: ${WORKER_MACHINE_COUNT}
selector:
matchLabels:
template:
spec:
clusterName: "${CLUSTER_NAME}"
version: "${KUBERNETES_VERSION}"
bootstrap:
configRef:
name: "${CLUSTER_NAME}-md-0"
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
infrastructureRef:
name: "${CLUSTER_NAME}-md-0"
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: IBMVPCMachineTemplate
---
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: IBMVPCMachineTemplate
metadata:
name: "${CLUSTER_NAME}-md-0"
spec:
template:
spec:
image: "${IBMVPC_IMAGE_ID}"
zone: "${IBMVPC_ZONE}"
profile: "${IBMVPC_PROFILE}"
sshKeys:
- "${IBMVPC_SSHKEY_ID}"
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
metadata:
name: "${CLUSTER_NAME}-md-0"
spec:
template:
spec:
joinConfiguration:
nodeRegistration:
kubeletExtraArgs:
cloud-provider: external
provider-id: ibmvpc://${CLUSTER_NAME}/'{{ v1.local_hostname }}'
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%

0 comments on commit b278813

Please sign in to comment.