Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Commit 7148551

Browse files
authored
Merge pull request #382 from lblackstone/single-node-self-hosted-etcd
Single node self hosted etcd
2 parents 705126d + 0a7c713 commit 7148551

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

hack/single-node/bootkube-up

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,19 @@ if [ ${un} == 'Darwin' ]; then
99
local_os="darwin"
1010
fi
1111

12+
SELF_HOST_ETCD=${SELF_HOST_ETCD:-false}
13+
if [ ${SELF_HOST_ETCD} = "true" ]; then
14+
echo "WARNING: THIS IS NOT YET FULLY WORKING - merely here to make ongoing testing easier"
15+
etcd_render_flags="--experimental-self-hosted-etcd"
16+
etcd_start_flags="--etcd-server=http://172.17.4.100:12379 --experimental-self-hosted-etcd"
17+
else
18+
etcd_render_flags=""
19+
etcd_start_flags=""
20+
fi
21+
1222
# Render assets
1323
if [ ! -d "cluster" ]; then
14-
../../_output/bin/${local_os}/bootkube render --asset-dir=cluster --api-servers=https://172.17.4.100:443
24+
../../_output/bin/${local_os}/bootkube render --asset-dir=cluster --api-servers=https://172.17.4.100:443 ${etcd_render_flags}
1525
cp user-data.sample cluster/user-data
1626
fi
1727

@@ -24,7 +34,7 @@ scp -q -F ssh_config -r cluster core@default:/home/core/cluster
2434
scp -q -F ssh_config ../../_output/bin/linux/bootkube core@default:/home/core
2535

2636
# Run bootkube
27-
ssh -q -F ssh_config core@default "sudo GLOG_v=${GLOG_v} /home/core/bootkube start --asset-dir=/home/core/cluster 2>> /home/core/bootkube.log"
37+
ssh -q -F ssh_config core@default "sudo GLOG_v=${GLOG_v} /home/core/bootkube start --asset-dir=/home/core/cluster ${etcd_start_flags} 2>> /home/core/bootkube.log"
2838

2939
echo
3040
echo "Bootstrap complete. Access your kubernetes cluster using:"

pkg/util/etcdutil/start_etcd.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,21 @@ import (
66
"net/http"
77
"time"
88

9+
"os"
10+
"path/filepath"
11+
912
"github.com/golang/glog"
1013
)
1114

1215
const bootEtcdFilePath = "/etc/kubernetes/manifests/boot-etcd.yaml"
1316

1417
func StartEtcd(endpoint string) error {
18+
dir := filepath.Dir(bootEtcdFilePath)
19+
if err := os.MkdirAll(dir, 0700); err != nil {
20+
return fmt.Errorf("failed to create directory '%s': %v", dir, err)
21+
}
1522
if err := ioutil.WriteFile(bootEtcdFilePath, []byte(etcdPodYaml), 0600); err != nil {
16-
return fmt.Errorf("fail to write file '/etc/kubernetes/manifests/boot-etcd.yaml': %v", err)
23+
return fmt.Errorf("failed to write file '%s': %v", bootEtcdFilePath, err)
1724
}
1825
glog.Info("etcd server has been defined to run by kubelet. Please wait...")
1926
return waitEtcdUp(endpoint)

0 commit comments

Comments
 (0)