mirror of https://github.com/k3s-io/k3s
Mount etcd data directory to host
parent
ac849dab8e
commit
a2a807b50d
|
@ -42,6 +42,7 @@ func getEnvParams() map[string]string {
|
|||
envParams := map[string]string{
|
||||
"prefix": globalPrefix,
|
||||
"host_pki_path": path.Join(globalPrefix, "pki"),
|
||||
"host_etcd_path": "/var/lib/etcd",
|
||||
"hyperkube_image": "",
|
||||
"discovery_image": "dgoodwin/kubediscovery:latest", // TODO(phase1): fmt.Sprintf("gcr.io/google_containers/kube-discovery-%s:%s", runtime.GOARCH, "1.0"),
|
||||
"etcd_image": "",
|
||||
|
|
|
@ -63,11 +63,12 @@ func WriteStaticPodManifests(s *kubeadmapi.KubeadmConfig) error {
|
|||
"--advertise-client-urls=http://127.0.0.1:2379",
|
||||
"--data-dir=/var/etcd/data",
|
||||
},
|
||||
VolumeMounts: []api.VolumeMount{etcdVolumeMount()},
|
||||
Image: images.GetCoreImage(images.KubeEtcdImage, s.EnvParams["etcd_image"]),
|
||||
LivenessProbe: componentProbe(2379, "/health"),
|
||||
Name: etcd,
|
||||
Resources: componentResources("200m"),
|
||||
}),
|
||||
}, etcdVolume(s)),
|
||||
// TODO bind-mount certs in
|
||||
kubeAPIServer: componentPod(api.Container{
|
||||
Name: kubeAPIServer,
|
||||
|
@ -111,6 +112,22 @@ func WriteStaticPodManifests(s *kubeadmapi.KubeadmConfig) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func etcdVolume(s *kubeadmapi.KubeadmConfig) api.Volume {
|
||||
return api.Volume{
|
||||
Name: "etcd",
|
||||
VolumeSource: api.VolumeSource{
|
||||
HostPath: &api.HostPathVolumeSource{Path: s.EnvParams["host_etcd_path"]},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func etcdVolumeMount() api.VolumeMount {
|
||||
return api.VolumeMount{
|
||||
Name: "etcd",
|
||||
MountPath: "/var/etcd",
|
||||
}
|
||||
}
|
||||
|
||||
func pkiVolume(s *kubeadmapi.KubeadmConfig) api.Volume {
|
||||
return api.Volume{
|
||||
Name: "pki",
|
||||
|
|
Loading…
Reference in New Issue