Add Sidero bootstrap

This commit is contained in:
Khue Doan 2021-07-18 16:12:13 +07:00
parent 9bac96ae96
commit d8d170b58a
No known key found for this signature in database
GPG Key ID: 4C1A90A461B3C27B
4 changed files with 200 additions and 0 deletions

37
bootstrap/bootstrap.sh Normal file
View File

@ -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

View File

@ -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

25
bootstrap/server.yaml Normal file
View File

@ -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

View File

@ -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.