-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add cluster template with bootstrap scripts, use CAAPH to install cilium
- Loading branch information
1 parent
b97d844
commit 7ae221c
Showing
2 changed files
with
223 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,222 @@ | ||
apiVersion: cluster.x-k8s.io/v1beta1 | ||
kind: Cluster | ||
metadata: | ||
name: ${CLUSTER_NAME} | ||
labels: | ||
cni: cilium | ||
spec: | ||
clusterNetwork: | ||
pods: | ||
cidrBlocks: | ||
- 192.168.0.0/16 | ||
controlPlaneRef: | ||
apiVersion: controlplane.cluster.x-k8s.io/v1beta1 | ||
kind: KubeadmControlPlane | ||
name: ${CLUSTER_NAME}-control-plane | ||
infrastructureRef: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 | ||
kind: LinodeCluster | ||
name: ${CLUSTER_NAME} | ||
--- | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 | ||
kind: LinodeCluster | ||
metadata: | ||
name: ${CLUSTER_NAME} | ||
namespace: default | ||
spec: | ||
region: ${LINODE_REGION} | ||
--- | ||
apiVersion: addons.cluster.x-k8s.io/v1alpha1 | ||
kind: HelmChartProxy | ||
metadata: | ||
name: cilium | ||
spec: | ||
clusterSelector: | ||
matchLabels: | ||
cni: cilium | ||
repoURL: https://helm.cilium.io/ | ||
chartName: cilium | ||
options: | ||
waitForJobs: true | ||
wait: true | ||
timeout: 5m | ||
valuesTemplate: | | ||
operator: | ||
replicas: 1 | ||
hubble: | ||
relay: | ||
enabled: true | ||
ui: | ||
enabled: true | ||
--- | ||
kind: KubeadmControlPlane | ||
apiVersion: controlplane.cluster.x-k8s.io/v1beta1 | ||
metadata: | ||
name: ${CLUSTER_NAME}-control-plane | ||
spec: | ||
replicas: ${CONTROL_PLANE_MACHINE_COUNT} | ||
machineTemplate: | ||
infrastructureRef: | ||
kind: LinodeMachineTemplate | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 | ||
name: ${CLUSTER_NAME}-control-plane | ||
kubeadmConfigSpec: | ||
files: | ||
- path: /etc/containerd/config.toml | ||
content: | | ||
version = 2 | ||
imports = ["/etc/containerd/conf.d/*.toml"] | ||
[plugins] | ||
[plugins."io.containerd.grpc.v1.cri"] | ||
sandbox_image = "registry.k8s.io/pause:3.9" | ||
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc] | ||
runtime_type = "io.containerd.runc.v2" | ||
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] | ||
SystemdCgroup = true | ||
- path: /etc/modules-load.d/k8s.conf | ||
content: | | ||
overlay | ||
br_netfilter | ||
- path: /etc/sysctl.d/k8s.conf | ||
content: | | ||
net.bridge.bridge-nf-call-iptables = 1 | ||
net.bridge.bridge-nf-call-ip6tables = 1 | ||
net.ipv4.ip_forward = 1 | ||
- path: /kubeadm-init.sh | ||
content: | | ||
#!/bin/bash | ||
export DEBIAN_FRONTEND=noninteractive | ||
hostnamectl set-hostname "$1" && hostname -F /etc/hostname | ||
mkdir -p -m 755 /etc/apt/keyrings | ||
VERSION=${2%.*} | ||
curl -fsSL "https://pkgs.k8s.io/core:/stable:/v$VERSION/deb/Release.key" | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg | ||
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v$VERSION/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list | ||
apt-get update -y | ||
apt-get install -y kubelet kubeadm kubectl containerd | ||
apt-mark hold kubelet kubeadm kubectl containerd | ||
modprobe overlay | ||
modprobe br_netfilter | ||
sysctl --system | ||
permissions: "0777" | ||
preKubeadmCommands: | ||
- /kubeadm-init.sh '{{ ds.meta_data.label }}' "${KUBERNETES_VERSION}" | ||
clusterConfiguration: | ||
apiServer: | ||
extraArgs: | ||
cloud-provider: external | ||
timeoutForControlPlane: 20m | ||
initConfiguration: | ||
nodeRegistration: | ||
kubeletExtraArgs: | ||
cloud-provider: external | ||
provider-id: 'linode:///{{ ds.meta_data.region }}/{{ ds.meta_data.id }}' | ||
name: '{{ ds.meta_data.label }}' | ||
joinConfiguration: | ||
nodeRegistration: | ||
kubeletExtraArgs: | ||
cloud-provider: external | ||
provider-id: 'linode:///{{ ds.meta_data.region }}/{{ ds.meta_data.id }}' | ||
name: '{{ ds.meta_data.label }}' | ||
version: "${KUBERNETES_VERSION}" | ||
--- | ||
kind: LinodeMachineTemplate | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 | ||
metadata: | ||
name: ${CLUSTER_NAME}-control-plane | ||
spec: | ||
template: | ||
spec: | ||
image: ${LINODE_OS} | ||
type: ${LINODE_CONTROL_PLANE_MACHINE_TYPE} | ||
region: ${LINODE_REGION} | ||
authorizedKeys: | ||
- ${LINODE_SSH_KEY} | ||
--- | ||
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/v1alpha1 | ||
kind: LinodeMachineTemplate | ||
--- | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 | ||
kind: LinodeMachineTemplate | ||
metadata: | ||
name: ${CLUSTER_NAME}-md-0 | ||
spec: | ||
template: | ||
spec: | ||
image: ${LINODE_OS} | ||
type: ${LINODE_MACHINE_TYPE} | ||
region: ${LINODE_REGION} | ||
authorizedKeys: | ||
- ${LINODE_SSH_KEY} | ||
--- | ||
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 | ||
kind: KubeadmConfigTemplate | ||
metadata: | ||
name: ${CLUSTER_NAME}-md-0 | ||
spec: | ||
template: | ||
spec: | ||
files: | ||
- path: /etc/containerd/config.toml | ||
content: | | ||
version = 2 | ||
imports = ["/etc/containerd/conf.d/*.toml"] | ||
[plugins] | ||
[plugins."io.containerd.grpc.v1.cri"] | ||
sandbox_image = "registry.k8s.io/pause:3.9" | ||
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc] | ||
runtime_type = "io.containerd.runc.v2" | ||
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] | ||
SystemdCgroup = true | ||
- path: /etc/modules-load.d/k8s.conf | ||
content: | | ||
overlay | ||
br_netfilter | ||
- path: /etc/sysctl.d/k8s.conf | ||
content: | | ||
net.bridge.bridge-nf-call-iptables = 1 | ||
net.bridge.bridge-nf-call-ip6tables = 1 | ||
net.ipv4.ip_forward = 1 | ||
- path: /kubeadm-init.sh | ||
content: | | ||
#!/bin/bash | ||
export DEBIAN_FRONTEND=noninteractive | ||
hostnamectl set-hostname "$1" && hostname -F /etc/hostname | ||
mkdir -p -m 755 /etc/apt/keyrings | ||
VERSION=${2%.*} | ||
curl -fsSL "https://pkgs.k8s.io/core:/stable:/v$VERSION/deb/Release.key" | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg | ||
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v$VERSION/deb/ /" | sudo tee /etc/apt/sources.list.d/kubernetes.list | ||
apt-get update -y | ||
apt-get install -y kubelet kubeadm kubectl containerd | ||
apt-mark hold kubelet kubeadm kubectl containerd | ||
modprobe overlay | ||
modprobe br_netfilter | ||
sysctl --system | ||
permissions: "0777" | ||
preKubeadmCommands: | ||
- /kubeadm-init.sh '{{ ds.meta_data.label }}' "${KUBERNETES_VERSION}" | ||
joinConfiguration: | ||
nodeRegistration: | ||
kubeletExtraArgs: | ||
cloud-provider: external | ||
provider-id: 'linode:///{{ ds.meta_data.region }}/{{ ds.meta_data.id }}' | ||
name: '{{ ds.meta_data.label }}' |