Skip to content

Commit

Permalink
add kubeadm-vpcless flavor
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulait committed Apr 18, 2024
1 parent ff1b7c6 commit da12914
Show file tree
Hide file tree
Showing 11 changed files with 130 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- [ClusterClass kubeadm](./topics/flavors/clusterclass-kubeadm.md)
- [k3s](./topics/flavors/k3s.md)
- [rke2](./topics/flavors/rke2.md)
- [vpcless (kubeadm)](./topics/flavors/vpcless.md)
- [Etcd](./topics/etcd.md)
- [Backups](./topics/backups.md)
- [Multi-Tenancy](./topics/multi-tenancy.md)
Expand Down
28 changes: 28 additions & 0 deletions docs/src/topics/flavors/vpcless.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# VPCLess

This flavor supports provisioning k8s clusters outside of VPC. It uses kubeadm for
setting up control plane and uses cilium with VXLAN for pod networking.

## Specification
| Control Plane | CNI | Default OS | Installs ClusterClass | IPv4 | IPv6 |
|---------------|--------|--------------|-----------------------|------|------|
| Kubeadm | Cilium | Ubuntu 22.04 | No | Yes | No |
## Prerequisites
[Quickstart](../getting-started.md) completed

## Notes
This flavor is identical to the default flavor with the exception that it provisions
k8s clusters without VPC. Since it runs outside of VPC, native routing is not
supported in this flavor and it uses VXLAN for pod to pod communication.

## Usage
1. Generate cluster yaml
```bash
clusterctl generate cluster test-cluster \
--infrastructure linode:0.0.0 \
--flavor vpcless > test-cluster.yaml
```
2. Apply cluster yaml
```bash
kubectl apply -f test-cluster.yaml
```
27 changes: 27 additions & 0 deletions templates/addons/cilium/cilium-vxlan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: addons.cluster.x-k8s.io/v1alpha1
kind: HelmChartProxy
metadata:
name: cilium-vxlan
spec:
clusterSelector:
matchLabels:
cni: cilium
vxlan: "true"
repoURL: https://helm.cilium.io/
chartName: cilium
namespace: kube-system
version: ${CILIUM_VERSION:=1.15.0}
options:
waitForJobs: true
wait: true
timeout: 5m
valuesTemplate: |
ipam:
mode: kubernetes
k8s:
requireIPv4PodCIDR: true
hubble:
relay:
enabled: true
ui:
enabled: true
1 change: 1 addition & 0 deletions templates/addons/cilium/cilium.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ spec:
clusterSelector:
matchExpressions:
- {key: ipv6, operator: DoesNotExist}
- {key: vxlan, operator: DoesNotExist}
- {key: cni, operator: In, values: ['cilium']}
repoURL: https://helm.cilium.io/
chartName: cilium
Expand Down
1 change: 1 addition & 0 deletions templates/addons/cilium/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ kind: Kustomization
resources:
- cilium.yaml
- cilium-ipv6.yaml
- cilium-vxlan.yaml
1 change: 1 addition & 0 deletions templates/addons/provider-linode/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- linode-ccm.yaml
- linode-ccm-vpcless.yaml
22 changes: 22 additions & 0 deletions templates/addons/provider-linode/linode-ccm-vpcless.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: addons.cluster.x-k8s.io/v1alpha1
kind: HelmChartProxy
metadata:
name: linode-cloud-controller-manager-vpcless
spec:
clusterSelector:
matchLabels:
ccm: linode
vpcless: "true"
repoURL: https://linode.github.io/linode-cloud-controller-manager/
chartName: ccm-linode
namespace: kube-system
version: ${LINODE_CCM_VERSION:=v0.4.3}
options:
waitForJobs: true
wait: true
timeout: 5m
valuesTemplate: |
secretRef:
name: "linode-token-region"
image:
pullPolicy: IfNotPresent
5 changes: 3 additions & 2 deletions templates/addons/provider-linode/linode-ccm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ metadata:
name: linode-cloud-controller-manager
spec:
clusterSelector:
matchLabels:
ccm: linode
matchExpressions:
- {key: vpcless, operator: DoesNotExist}
- {key: ccm, operator: In, values: ['linode']}
repoURL: https://linode.github.io/linode-cloud-controller-manager/
chartName: ccm-linode
namespace: kube-system
Expand Down
6 changes: 4 additions & 2 deletions templates/common-init-files/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@ stringData:
sysctl --system
sed -i '/swap/d' /etc/fstab
swapoff -a
IPADDR=$(ip a s eth1 |grep 'inet ' |cut -d' ' -f6|cut -d/ -f1)
sed -i "s/kubeletExtraArgs:/kubeletExtraArgs:\n node-ip: $IPADDR/g" /run/kubeadm/kubeadm.yaml
if [ -d "/sys/class/net/eth1" ]; then
IPADDR=$(ip a s eth1 |grep 'inet ' |cut -d' ' -f6|cut -d/ -f1)
sed -i "s/kubeletExtraArgs:/kubeletExtraArgs:\n node-ip: $IPADDR/g" /run/kubeadm/kubeadm.yaml
fi
5 changes: 5 additions & 0 deletions templates/flavors/vpcless/deleteLinodeVPC.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
$patch: delete
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: LinodeVPC
metadata:
name: ${VPC_NAME:=${CLUSTER_NAME}}
37 changes: 37 additions & 0 deletions templates/flavors/vpcless/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../default

patches:
- path: deleteLinodeVPC.yaml
- target:
group: infrastructure.cluster.x-k8s.io
version: v1alpha1
kind: LinodeCluster
patch: |-
- op: remove
path: /spec/vpcRef
- target:
group: controlplane.cluster.x-k8s.io
version: v1beta1
kind: KubeadmControlPlane
patch: |-
- op: remove
path: /spec/kubeadmConfigSpec/initConfiguration/skipPhases
- target:
group: cluster.x-k8s.io
version: v1beta1
kind: Cluster
patch: |-
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: ${CLUSTER_NAME}
labels:
cni: cilium
vxlan: "true"
ccm: linode
vpcless: "true"
csi: linode
crs: ${CLUSTER_NAME}-crs

0 comments on commit da12914

Please sign in to comment.