diff --git a/bootstrap/bootstrap.sh b/bootstrap/bootstrap.sh new file mode 100644 index 00000000..cec3e840 --- /dev/null +++ b/bootstrap/bootstrap.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +set -e + +# DHCP server + +export PUBLIC_IP="192.168.1.19" + +talosctl cluster create \ + -p 69:69/udp,8081:8081/tcp \ + --workers 0 \ + --endpoint $PUBLIC_IP + +kubectl taint node talos-default-master-1 node-role.kubernetes.io/master:NoSchedule- + +SIDERO_CONTROLLER_MANAGER_HOST_NETWORK=true \ +SIDERO_CONTROLLER_MANAGER_API_ENDPOINT=$PUBLIC_IP \ +SIDERO_CONTROLLER_MANAGER_AUTO_ACCEPT_SERVERS=true \ +clusterctl init -b talos -c talos -i sidero + +kubectl get servers -o wide + +wol '00:23:24:d1:f3:f0' + +kubectl edit server.metal.sidero.dev/d7a60000-720c-7a4c-81d5-1db10300eae2 +# spec: +# configPatches: +# - op: replace +# path: /machine/install/disk +# value: /dev/sda + +export CONTROL_PLANE_SERVERCLASS=any +export WORKER_SERVERCLASS=any +export KUBERNETES_VERSION=v1.20.1 +export CONTROL_PLANE_PORT=6443 +export CONTROL_PLANE_ENDPOINT=1.2.3.4 +clusterctl config cluster management-plane -i sidero > management-plane.yaml diff --git a/bootstrap/management-plane.yaml b/bootstrap/management-plane.yaml new file mode 100644 index 00000000..cda13c2a --- /dev/null +++ b/bootstrap/management-plane.yaml @@ -0,0 +1,112 @@ +apiVersion: cluster.x-k8s.io/v1alpha3 +kind: Cluster +metadata: + name: management-plane + namespace: default +spec: + clusterNetwork: + pods: + cidrBlocks: + - 10.244.0.0/16 + services: + cidrBlocks: + - 10.96.0.0/12 + controlPlaneRef: + apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 + kind: TalosControlPlane + name: management-plane-cp + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 + kind: MetalCluster + name: management-plane +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 +kind: MetalCluster +metadata: + name: management-plane + namespace: default +spec: + controlPlaneEndpoint: + host: 1.2.3.4 + port: 6443 +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 +kind: MetalMachineTemplate +metadata: + name: management-plane-cp + namespace: default +spec: + template: + spec: + serverClassRef: + apiVersion: metal.sidero.dev/v1alpha1 + kind: ServerClass + name: any +--- +apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 +kind: TalosControlPlane +metadata: + name: management-plane-cp + namespace: default +spec: + controlPlaneConfig: + controlplane: + generateType: controlplane + talosVersion: v0.11.2 + init: + generateType: init + talosVersion: v0.11.2 + infrastructureTemplate: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 + kind: MetalMachineTemplate + name: management-plane-cp + replicas: 1 + version: v1.20.1 +--- +apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 +kind: TalosConfigTemplate +metadata: + name: management-plane-workers + namespace: default +spec: + template: + spec: + generateType: join + talosVersion: v0.11.2 +--- +apiVersion: cluster.x-k8s.io/v1alpha3 +kind: MachineDeployment +metadata: + name: management-plane-workers + namespace: default +spec: + clusterName: management-plane + replicas: 0 + selector: + matchLabels: null + template: + spec: + bootstrap: + configRef: + apiVersion: bootstrap.cluster.x-k8s.io/v1alpha3 + kind: TalosConfigTemplate + name: management-plane-workers + clusterName: management-plane + infrastructureRef: + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 + kind: MetalMachineTemplate + name: management-plane-workers + version: v1.20.1 +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3 +kind: MetalMachineTemplate +metadata: + name: management-plane-workers + namespace: default +spec: + template: + spec: + serverClassRef: + apiVersion: metal.sidero.dev/v1alpha1 + kind: ServerClass + name: any diff --git a/bootstrap/server.yaml b/bootstrap/server.yaml new file mode 100644 index 00000000..b2436f0d --- /dev/null +++ b/bootstrap/server.yaml @@ -0,0 +1,25 @@ +apiVersion: metal.sidero.dev/v1alpha1 +kind: Server +metadata: + finalizers: + - storage.finalizers.server.k8s.io + name: d7a60000-720c-7a4c-81d5-1db10300eae2 + resourceVersion: "2263" + uid: 9dd66e1f-c1c4-4c99-98a7-2b50d675d362 +spec: + accepted: true + configPatches: + - op: replace + path: /machine/install/disk + value: /dev/sda + cpu: + manufacturer: Intel(R) Corporation + version: Intel(R) Core(TM) i5-6600T CPU @ 2.70GHz + hostname: 192.168.1.4 + system: + family: MATE + manufacturer: NEC + productName: PC-MK26ECZDR + serialNumber: 6Y001301A + skuNumber: PC-MK26ECZDP42RN11UZ + version: NEC Product diff --git a/bootstrap/serverclass.yaml b/bootstrap/serverclass.yaml new file mode 100644 index 00000000..bd10c395 --- /dev/null +++ b/bootstrap/serverclass.yaml @@ -0,0 +1,26 @@ +apiVersion: metal.sidero.dev/v1alpha1 +kind: ServerClass +metadata: + name: nec +spec: + selector: + matchLabels: + common-label: "true" + matchExpressions: + - key: zone + operator: In + values: + - central + - east + - key: environment + operator: NotIn + values: + - prod + qualifiers: + cpu: + - manufacturer: "Intel(R) Corporation" + version: "Intel(R) Atom(TM) CPU C3558 @ 2.20GHz" + - manufacturer: Advanced Micro Devices, Inc. + version: AMD Ryzen 7 2700X Eight-Core Processor + system: + manufacturer: Dell Inc.