From 3da62ff7a1189049c16ba7f26565e940766c387c Mon Sep 17 00:00:00 2001 From: Khue Doan Date: Sat, 24 Jul 2021 02:33:02 +0700 Subject: [PATCH] Create DHCP server when bootstrap --- infra/bootstrap.sh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/infra/bootstrap.sh b/infra/bootstrap.sh index 4140f6e8..fb8307af 100755 --- a/infra/bootstrap.sh +++ b/infra/bootstrap.sh @@ -15,6 +15,21 @@ clusterctl init \ --infrastructure sidero \ --kubeconfig ephemeral-cluster/kind-kubeconfig.yaml \ --config clusterctl.yaml + +# Create DHCP server +# kubectl create configmap dhcp-server \ +# --kubeconfig ephemeral-cluster/kind-kubeconfig.yaml \ +# --from-file dhcp-server/dhcpd.conf +# kubectl apply \ +# --kubeconfig ephemeral-cluster/kind-kubeconfig.yaml \ +# --filename dhcp-server/deployment.yaml +docker run --detach \ + --name bootstrap-dhcp-server \ + --network=host \ + --volume $PWD/dhcp-server/dhcpd.conf:/data/dhcpd.conf \ + networkboot/dhcpd:1.1.0 + +# Wait for all pods to be ready kubectl wait pods \ --kubeconfig ephemeral-cluster/kind-kubeconfig.yaml \ --all \ @@ -52,5 +67,6 @@ clusterctl get kubeconfig \ homelab > kubeconfig.yaml # Cleanup ephemeral cluster -# kind delete cluster --name bootstrap-cluster -# rm ephemeral-cluster/kind-kubeconfig.yaml +kind delete cluster --name bootstrap-cluster +rm ephemeral-cluster/kind-kubeconfig.yaml +docker rm --force bootstrap-dhcp-server