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 {