diff --git a/docs/book/src/SUMMARY.md b/docs/book/src/SUMMARY.md index e73a114ef..ba5afa441 100644 --- a/docs/book/src/SUMMARY.md +++ b/docs/book/src/SUMMARY.md @@ -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) diff --git a/docs/book/src/topics/vpc/load-balancer.md b/docs/book/src/topics/vpc/load-balancer.md new file mode 100644 index 000000000..b68206dfb --- /dev/null +++ b/docs/book/src/topics/vpc/load-balancer.md @@ -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 - +``` diff --git a/templates/cluster-template-load-balancer.yaml b/templates/cluster-template-load-balancer.yaml new file mode 100644 index 000000000..285b177b2 --- /dev/null +++ b/templates/cluster-template-load-balancer.yaml @@ -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%