diff --git a/bootstrap/bootstrap.sh b/bootstrap/bootstrap.sh index 5f51e30d..e7cb1dcc 100755 --- a/bootstrap/bootstrap.sh +++ b/bootstrap/bootstrap.sh @@ -2,45 +2,39 @@ set -e -# DHCP server +# Create ephemeral cluster +kind create cluster \ + --wait 60s \ + --config kind.yaml -talosctl cluster create \ - -p 69:69/udp,8081:8081/tcp \ - --workers 0 \ - --endpoint '192.168.1.19' +# Install Sidero +clusterctl init \ + --bootstrap talos \ + --control-plane talos \ + --infrastructure sidero \ + --config clusterctl.yaml +kubectl wait pods \ + --all \ + --all-namespaces \ + --for=condition=Ready -kubectl taint node talos-default-master-1 node-role.kubernetes.io/master:NoSchedule- - -clusterctl init -b talos -c talos -i sidero --config clusterctl.yaml +# Apply server classes +kubectl apply \ + --filename serverclasses/ +# Waker servers up wol '00:23:24:d1:f3:f0' # wol '00:23:24:d1:f4:d6' # wol '00:23:24:d1:f5:69' # wol '00:23:24:e7:04:60' -kubectl apply -f serverclasses +# Create cluster +export CONTROL_PLANE_ENDPOINT=$(kubectl get server -o jsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}') +clusterctl config cluster homelab \ + --infrastructure sidero \ + --config clusterctl.yaml > cluster/homelab.yaml +kubectl apply \ + --filename cluster/homelab.yaml -# Wait for servers to register - -sleep 30 - -clusterctl config cluster management-plane -i sidero --config clusterctl.yaml > cluster/management-plane.yaml - -kubectl apply -f cluster/ - -kubectl get talosconfig \ - -l cluster.x-k8s.io/cluster-name=management-plane \ - -o yaml -o jsonpath='{.items[0].status.talosConfig}' > management-plane-talosconfig.yaml - -clusterctl init \ - --kubeconfig-context=admin@management-plane - -i sidero -b talos -c talos - -clusterctl move \ - --kubeconfig-context=admin@talos-default \ - --to-kubeconfig=$HOME/.kube/config \ - --to-kubeconfig-context=admin@management-plane - -kubectl taint node talos-192-168-1-24 node-role.kubernetes.io/master:NoSchedule- - -kubectl patch deploy -n sidero-system sidero-controller-manager --type='json' -p='[{"op": "add", "path": "/spec/template/spec/hostNetwork", "value": true}]' +# Get kube config +clusterctl get kubeconfig homelab > kubeconfig.yaml diff --git a/bootstrap/clusterctl.yaml b/bootstrap/clusterctl.yaml index f1331198..022408e9 100644 --- a/bootstrap/clusterctl.yaml +++ b/bootstrap/clusterctl.yaml @@ -5,7 +5,6 @@ SIDERO_CONTROLLER_MANAGER_HOST_NETWORK: true CONTROL_PLANE_SERVERCLASS: m5.xlarge WORKER_SERVERCLASS: m5.xlarge -CONTROL_PLANE_ENDPOINT: 192.168.1.12 CONTROL_PLANE_PORT: 6443 KUBERNETES_VERSION: v1.21.1