Skip to content

Instantly share code, notes, and snippets.

@usrbinkat
Last active February 17, 2025 02:19
Show Gist options
  • Save usrbinkat/f5b712c79c890f9deab0a2dacd5ecd0a to your computer and use it in GitHub Desktop.
Save usrbinkat/f5b712c79c890f9deab0a2dacd5ecd0a to your computer and use it in GitHub Desktop.
Kubernetes Multi Cluster Platform as a Service R&D
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: "${CLUSTER_NAME}"
namespace: "${NAMESPACE}"
spec:
clusterNetwork:
pods:
cidrBlocks:
- 10.243.0.0/16
services:
cidrBlocks:
- 10.95.0.0/16
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: KubevirtCluster
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/v1alpha1
kind: KubevirtCluster
metadata:
name: "${CLUSTER_NAME}"
namespace: "${NAMESPACE}"
spec:
controlPlaneServiceTemplate:
spec:
type: ClusterIP
---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: KubevirtMachineTemplate
metadata:
name: "${CLUSTER_NAME}-control-plane"
namespace: "${NAMESPACE}"
spec:
template:
spec:
virtualMachineTemplate:
metadata:
namespace: "${NAMESPACE}"
spec:
runStrategy: Always
template:
spec:
domain:
cpu:
cores: 2
memory:
guest: "4Gi"
devices:
disks:
- disk:
bus: virtio
name: containervolume
evictionStrategy: External
volumes:
- containerDisk:
image: "${NODE_VM_IMAGE_TEMPLATE}"
name: containervolume
---
kind: KubeadmControlPlane
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
metadata:
name: "${CLUSTER_NAME}-control-plane"
namespace: "${NAMESPACE}"
spec:
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
machineTemplate:
infrastructureRef:
kind: KubevirtMachineTemplate
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
name: "${CLUSTER_NAME}-control-plane"
namespace: "${NAMESPACE}"
kubeadmConfigSpec:
clusterConfiguration:
imageRepository: ${IMAGE_REPO}
networking:
dnsDomain: "${CLUSTER_NAME}.${NAMESPACE}.local"
podSubnet: 10.243.0.0/16
serviceSubnet: 10.95.0.0/16
initConfiguration:
nodeRegistration:
criSocket: "${CRI_PATH}"
joinConfiguration:
nodeRegistration:
criSocket: "{CRI_PATH}"
version: "${KUBERNETES_VERSION}"
---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: KubevirtMachineTemplate
metadata:
name: "${CLUSTER_NAME}-md-0"
namespace: "${NAMESPACE}"
spec:
template:
spec:
virtualMachineTemplate:
metadata:
namespace: "${NAMESPACE}"
spec:
runStrategy: Always
template:
spec:
domain:
cpu:
cores: 2
memory:
guest: "4Gi"
devices:
disks:
- disk:
bus: virtio
name: containervolume
evictionStrategy: External
volumes:
- containerDisk:
image: "${NODE_VM_IMAGE_TEMPLATE}"
name: containervolume
---
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
metadata:
name: "${CLUSTER_NAME}-md-0"
namespace: "${NAMESPACE}"
spec:
template:
spec:
joinConfiguration:
nodeRegistration:
kubeletExtraArgs: {}
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
name: "${CLUSTER_NAME}-md-0"
namespace: "${NAMESPACE}"
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"
namespace: "${NAMESPACE}"
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
infrastructureRef:
name: "${CLUSTER_NAME}-md-0"
namespace: "${NAMESPACE}"
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: KubevirtMachineTemplate
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
labels:
cluster-name: talos
name: talos
spec:
controlPlaneRef:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: TalosControlPlane
name: talos
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: KubevirtCluster
name: talos
clusterNetwork:
pods:
cidrBlocks:
- 192.168.3.0/16
services:
cidrBlocks:
- 172.26.0.0/16
---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: KubevirtCluster
metadata:
name: talos
spec:
controlPlaneServiceTemplate:
spec:
type: ClusterIP
---
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
name: talos
spec:
clusterName: talos
replicas: 0
selector:
matchLabes: null
template:
spec:
clusterName: talos
version: v1.23.5
bootstrap:
configRef:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: TalosConfigTemplate
name: talos
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: KubevirtMachineTemplate
name: talos
---
apiVersion: controlplane.cluster.x-k8s.io/v1alpha3
kind: TalosControlPlane
metadata:
name: talos
spec:
replicas: 1
version: "v1.25.2"
infrastructureTemplate:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: KubevirtMachineTemplate
name: talos-cp
controlPlaneConfig:
init:
generateType: init
configPatches:
- path: /machine/install
op: replace
value:
bootloader: true
disk: /dev/vda
image: ghcr.io/siderolabs/installer:v1.2.5
wipe: false
extraKernelArgs:
- console=ttyS0
- path: /machine/kubelet/extraArgs
op: add
value:
cloud-provider: external
- path: /machine/apiServer/extraArgs
op: add
value:
cloud-provider: external
- path: /machine/controllerManager/extraArgs
op: add
value:
cloud-provider: external
- path: /cluster/allowSchedulingOnMasters
op: add
value: true
controlplane:
generateType: controlplane
configPatches:
- path: /machine/install
op: replace
value:
bootloader: true
disk: /dev/vda
image: ghcr.io/siderolabs/installer:v1.2.5
wipe: false
extraKernelArgs:
- console=ttyS0
- path: /machine/kubelet/extraArgs
op: add
value:
cloud-provider: external
- path: /machine/apiServer/extraArgs
op: add
value:
cloud-provider: external
- path: /machine/controllerManager/extraArgs
op: add
value:
cloud-provider: external
- path: /cluster/allowSchedulingOnMasters
op: add
value: true
---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: KubevirtMachineTemplate
metadata:
name: talos-cp
spec:
template:
spec:
virtualMachineTemplate:
spec:
runStrategy: Always
template:
spec:
evictionStrategy: External
volumes:
- name: vmdisk
dataVolume:
name: vmdisk-cp-dv
domain:
cpu:
cores: 4
devices:
disks:
- name: vmdisk
disk:
bus: virtio
memory:
guest: "6Gi"
template:
spec:
nodeSelector:
node-role.kubernetes.io/kubevirt: ""
domain:
clock:
utc: {}
timer: {}
cpu:
cores: 1
sockets: 1
threads: 4
model: host-passthrough
dedicatedCpuPlacement: false
devices:
rng: {}
autoattachPodInterface: false
autoattachSerialConsole: true
autoattachGraphicsDevice: true
networkInterfaceMultiqueue: false
disks:
- name: vmdisk
bootOrder: 1
disk:
bus: virtio
interfaces:
- name: enp1s0
model: virtio
bridge: {}
machine:
type: q35
resources:
requests:
memory: 12G
devices.kubevirt.io/kvm: "1"
networks:
- name: enp1s0
multus:
networkName: nadbr0
terminationGracePeriodSeconds: 0
volumes:
- name: vmdisk
dataVolume:
name: vmdisk-cp-dv
dataVolumeTemplates:
- metadata:
name: vmdisk-dv
spec:
accessModes:
- ReadWriteMany
capacity:
storage: 64G
config:
featureGates:
- HonorWaitForFirstConsumer
pvc:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 64G
limits:
storage: 64G
storageClassName: ceph-filesystem
source:
registry:
url: "docker.io/katamo/talos:latest"
imagePullPolicy: Always
persistentVolumeReclaimPolicy: Delete
storageClassName: ceph-filesystem
volumeMode: Block
---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1
kind: KubevirtMachineTemplate
metadata:
name: talos
spec:
template:
spec:
virtualMachineTemplate:
spec:
runStrategy: Always
template:
spec:
evictionStrategy: External
volumes:
- name: vmdisk
dataVolume:
name: vmdisk-dv
domain:
cpu:
cores: 4
devices:
disks:
- name: vmdisk
disk:
bus: virtio
memory:
guest: "6Gi"
template:
spec:
nodeSelector:
node-role.kubernetes.io/kubevirt: ""
domain:
clock:
utc: {}
timer: {}
cpu:
cores: 1
sockets: 1
threads: 4
model: host-passthrough
dedicatedCpuPlacement: false
devices:
rng: {}
autoattachPodInterface: false
autoattachSerialConsole: true
autoattachGraphicsDevice: true
networkInterfaceMultiqueue: false
disks:
- name: vmdisk
bootOrder: 1
disk:
bus: virtio
interfaces:
- name: enp1s0
model: virtio
bridge: {}
machine:
type: q35
resources:
requests:
memory: 12G
devices.kubevirt.io/kvm: "1"
networks:
- name: enp1s0
multus:
networkName: nadbr0
terminationGracePeriodSeconds: 0
volumes:
- name: vmdisk
dataVolume:
name: vmdisk-dv
dataVolumeTemplates:
- metadata:
name: vmdisk-dv
spec:
accessModes:
- ReadWriteMany
capacity:
storage: 64G
config:
featureGates:
- HonorWaitForFirstConsumer
pvc:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 64G
limits:
storage: 64G
storageClassName: ceph-filesystem
source:
registry:
url: "docker.io/katamo/talos:latest"
imagePullPolicy: Always
persistentVolumeReclaimPolicy: Delete
storageClassName: ceph-filesystem
volumeMode: Block
---
apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3
kind: TalosConfigTemplate
metadata:
name: talos
spec:
template:
spec:
generateType: join
talosVersion: v1.2.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment