From 191ac9371a6fc387a9f8c9840be9755b9a2a970f Mon Sep 17 00:00:00 2001 From: galal-hussein Date: Tue, 30 Apr 2019 22:12:02 +0200 Subject: [PATCH] Add cni plugin to kubelet if docker is used --- pkg/agent/run.go | 1 + pkg/daemons/agent/agent.go | 3 +++ pkg/daemons/config/types.go | 1 + 3 files changed, 5 insertions(+) diff --git a/pkg/agent/run.go b/pkg/agent/run.go index 8fe6fc9c40..fada1255cd 100644 --- a/pkg/agent/run.go +++ b/pkg/agent/run.go @@ -33,6 +33,7 @@ func run(ctx context.Context, cfg cmds.Agent) error { if nodeConfig.Docker || nodeConfig.ContainerRuntimeEndpoint != "" { nodeConfig.AgentConfig.RuntimeSocket = nodeConfig.ContainerRuntimeEndpoint + nodeConfig.AgentConfig.CNIPlugin = true } else { if err := containerd.Run(ctx, nodeConfig); err != nil { return err diff --git a/pkg/daemons/agent/agent.go b/pkg/daemons/agent/agent.go index b4f2f635dc..cfcd4df04a 100644 --- a/pkg/daemons/agent/agent.go +++ b/pkg/daemons/agent/agent.go @@ -78,6 +78,9 @@ func kubelet(cfg *config.Agent) { if cfg.CNIBinDir != "" { argsMap["cni-bin-dir"] = cfg.CNIBinDir } + if cfg.CNIPlugin { + argsMap["network-plugin"] = "cni" + } if len(cfg.ClusterDNS) > 0 { argsMap["cluster-dns"] = cfg.ClusterDNS.String() } diff --git a/pkg/daemons/config/types.go b/pkg/daemons/config/types.go index 9b70a60351..e53bb2c10a 100644 --- a/pkg/daemons/config/types.go +++ b/pkg/daemons/config/types.go @@ -53,6 +53,7 @@ type Agent struct { CNIConfDir string ExtraKubeletArgs []string ExtraKubeProxyArgs []string + CNIPlugin bool } type Control struct {