mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Merge pull request #1695 from ibuildthecloud/kubeproxy
Add ability to disable kubeproxy
This commit is contained in:
commit
c941e1d0bb
@ -474,6 +474,7 @@ func get(envInfo *cmds.Agent) (*config.Node, error) {
|
||||
nodeConfig.AgentConfig.PrivateRegistry = envInfo.PrivateRegistry
|
||||
nodeConfig.AgentConfig.DisableCCM = controlConfig.DisableCCM
|
||||
nodeConfig.AgentConfig.DisableNPC = controlConfig.DisableNPC
|
||||
nodeConfig.AgentConfig.DisableKubeProxy = controlConfig.DisableKubeProxy
|
||||
nodeConfig.AgentConfig.Rootless = envInfo.Rootless
|
||||
nodeConfig.DisableSELinux = envInfo.DisableSELinux
|
||||
|
||||
|
@ -44,6 +44,7 @@ type Server struct {
|
||||
DefaultLocalStoragePath string
|
||||
DisableCCM bool
|
||||
DisableNPC bool
|
||||
DisableKubeProxy bool
|
||||
ClusterInit bool
|
||||
ClusterReset bool
|
||||
EncryptSecrets bool
|
||||
@ -210,6 +211,11 @@ func NewServerCommand(action func(*cli.Context) error) cli.Command {
|
||||
Usage: "(components) Disable k3s default cloud controller manager",
|
||||
Destination: &ServerConfig.DisableCCM,
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "disable-kube-proxy",
|
||||
Usage: "(components) Disable running kube-proxy",
|
||||
Destination: &ServerConfig.DisableKubeProxy,
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "disable-network-policy",
|
||||
Usage: "(components) Disable k3s default network policy controller",
|
||||
|
@ -98,6 +98,7 @@ func run(app *cli.Context, cfg *cmds.Server) error {
|
||||
serverConfig.ControlConfig.ExtraCloudControllerArgs = cfg.ExtraCloudControllerArgs
|
||||
serverConfig.ControlConfig.DisableCCM = cfg.DisableCCM
|
||||
serverConfig.ControlConfig.DisableNPC = cfg.DisableNPC
|
||||
serverConfig.ControlConfig.DisableKubeProxy = cfg.DisableKubeProxy
|
||||
serverConfig.ControlConfig.ClusterInit = cfg.ClusterInit
|
||||
serverConfig.ControlConfig.ClusterReset = cfg.ClusterReset
|
||||
serverConfig.ControlConfig.EncryptSecrets = cfg.EncryptSecrets
|
||||
|
@ -29,12 +29,15 @@ func Agent(config *config.Agent) error {
|
||||
defer logs.FlushLogs()
|
||||
|
||||
startKubelet(config)
|
||||
startKubeProxy(config)
|
||||
|
||||
if !config.DisableKubeProxy {
|
||||
return startKubeProxy(config)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func startKubeProxy(cfg *config.Agent) {
|
||||
func startKubeProxy(cfg *config.Agent) error {
|
||||
argsMap := map[string]string{
|
||||
"proxy-mode": "iptables",
|
||||
"healthz-bind-address": "127.0.0.1",
|
||||
@ -53,6 +56,8 @@ func startKubeProxy(cfg *config.Agent) {
|
||||
logrus.Infof("Running kube-proxy %s", config.ArgString(args))
|
||||
logrus.Fatalf("kube-proxy exited: %v", command.Execute())
|
||||
}()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func startKubelet(cfg *config.Agent) {
|
||||
|
@ -79,6 +79,7 @@ type Agent struct {
|
||||
PrivateRegistry string
|
||||
DisableCCM bool
|
||||
DisableNPC bool
|
||||
DisableKubeProxy bool
|
||||
Rootless bool
|
||||
}
|
||||
|
||||
@ -112,6 +113,7 @@ type Control struct {
|
||||
DefaultLocalStoragePath string
|
||||
DisableCCM bool
|
||||
DisableNPC bool
|
||||
DisableKubeProxy bool
|
||||
ClusterInit bool
|
||||
ClusterReset bool
|
||||
EncryptSecrets bool
|
||||
|
Loading…
Reference in New Issue
Block a user