Fix nested mounts issue when using default host prefix
@@ -361,7 +361,6 @@ func (c *Cluster) BuildKubeletProcess(host *hosts.Host, prefixPath string) v3.Pr
"/sys:/sys:rprivate",
host.DockerInfo.DockerRootDir + ":" + host.DockerInfo.DockerRootDir + ":rw,rslave,z",
fmt.Sprintf("%s:%s:shared,z", path.Join(prefixPath, "/var/lib/kubelet"), path.Join(prefixPath, "/var/lib/kubelet")),
- "/var/lib/kubelet/volumeplugins:/var/lib/kubelet/volumeplugins:shared,z",
"/var/lib/rancher:/var/lib/rancher:shared,z",
"/var/run:/var/run:rw,rprivate",
"/run:/run:rprivate",
@@ -372,6 +371,10 @@ func (c *Cluster) BuildKubeletProcess(host *hosts.Host, prefixPath string) v3.Pr
"/usr:/host/usr:ro",
"/etc:/host/etc:ro",
}
+ // Special case to simplify using flex volumes
+ if path.Join(prefixPath, "/var/lib/kubelet") != "/var/lib/kubelet" {
+ Binds = append(Binds, "/var/lib/kubelet/volumeplugins:/var/lib/kubelet/volumeplugins:shared,z")
+ }
for arg, value := range c.Services.Kubelet.ExtraArgs {
if _, ok := c.Services.Kubelet.ExtraArgs[arg]; ok {
