Version: v1.26.1 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2023 License: Apache-2.0 Imports: 32 Imported by: 266



Package options contains all of the primary arguments for a kubelet.



This section is empty.


This section is empty.


func AddGlobalFlags added in v1.10.0

func AddGlobalFlags(fs *pflag.FlagSet)

AddGlobalFlags explicitly registers flags that libraries (glog, verflag, etc.) register against the global flagsets from "flag" and "github.com/spf13/pflag". We do this in order to prevent unwanted flags from leaking into the Kubelet's flagset.

func AddKubeletConfigFlags added in v1.8.0

func AddKubeletConfigFlags(mainfs *pflag.FlagSet, c *kubeletconfig.KubeletConfiguration)

AddKubeletConfigFlags adds flags for a specific kubeletconfig.KubeletConfiguration to the specified FlagSet

func NewContainerRuntimeOptions added in v1.7.0

func NewContainerRuntimeOptions() *config.ContainerRuntimeOptions

NewContainerRuntimeOptions will create a new ContainerRuntimeOptions with default values.

func NewKubeletConfiguration added in v1.8.0

func NewKubeletConfiguration() (*kubeletconfig.KubeletConfiguration, error)

NewKubeletConfiguration will create a new KubeletConfiguration with default values

func ValidateKubeletFlags added in v1.8.0

func ValidateKubeletFlags(f *KubeletFlags) error

ValidateKubeletFlags validates Kubelet's configuration flags and returns an error if they are invalid.

func ValidateKubeletServer added in v1.8.0

func ValidateKubeletServer(s *KubeletServer) error

ValidateKubeletServer validates configuration of KubeletServer and returns an error if the input configuration is invalid.


type KubeletFlags added in v1.7.0

type KubeletFlags struct {
	KubeConfig          string
	BootstrapKubeconfig string

	// HostnameOverride is the hostname used to identify the kubelet instead
	// of the actual hostname.
	HostnameOverride string
	// NodeIP is IP address of the node.
	// If set, kubelet will use this IP address for the node.
	NodeIP string

	// Container-runtime-specific options.

	// certDirectory is the directory where the TLS certs are located.
	// If tlsCertFile and tlsPrivateKeyFile are provided, this flag will be ignored.
	CertDirectory string

	// cloudProvider is the provider for cloud services.
	// +optional
	CloudProvider string

	// cloudConfigFile is the path to the cloud provider configuration file.
	// +optional
	CloudConfigFile string

	// rootDirectory is the directory path to place kubelet files (volume
	// mounts,etc).
	RootDirectory string

	// The Kubelet will load its initial configuration from this file.
	// The path may be absolute or relative; relative paths are under the Kubelet's current working directory.
	// Omit this flag to use the combination of built-in default configuration values and flags.
	KubeletConfigFile string

	// WindowsService should be set to true if kubelet is running as a service on Windows.
	// Its corresponding flag only gets registered in Windows builds.
	WindowsService bool

	// WindowsPriorityClass sets the priority class associated with the Kubelet process
	// Its corresponding flag only gets registered in Windows builds
	// The default priority class associated with any process in Windows is NORMAL_PRIORITY_CLASS. Keeping it as is
	// to maintain backwards compatibility.
	// Source: https://docs.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities
	WindowsPriorityClass string

	// remoteRuntimeEndpoint is the endpoint of remote runtime service
	RemoteRuntimeEndpoint string
	// remoteImageEndpoint is the endpoint of remote image service
	RemoteImageEndpoint string
	// experimentalMounterPath is the path of mounter binary. Leave empty to use the default mount path
	ExperimentalMounterPath string
	// This flag, if set, will avoid including `EvictionHard` limits while computing Node Allocatable.
	// Refer to [Node Allocatable](https://git.k8s.io/community/contributors/design-proposals/node/node-allocatable.md) doc for more information.
	ExperimentalNodeAllocatableIgnoreEvictionThreshold bool
	// Node Labels are the node labels to add when registering the node in the cluster
	NodeLabels map[string]string
	// lockFilePath is the path that kubelet will use to as a lock file.
	// It uses this file as a lock to synchronize with other kubelet processes
	// that may be running.
	LockFilePath string
	// ExitOnLockContention is a flag that signifies to the kubelet that it is running
	// in "bootstrap" mode. This requires that 'LockFilePath' has been set.
	// This will cause the kubelet to listen to inotify events on the lock file,
	// releasing it and exiting when another process tries to open that file.
	ExitOnLockContention bool
	// minimumGCAge is the minimum age for a finished container before it is
	// garbage collected.
	MinimumGCAge metav1.Duration
	// maxPerPodContainerCount is the maximum number of old instances to
	// retain per container. Each container takes up some disk space.
	MaxPerPodContainerCount int32
	// maxContainerCount is the maximum number of old instances of containers
	// to retain globally. Each container takes up some disk space.
	MaxContainerCount int32
	// masterServiceNamespace is The namespace from which the kubernetes
	// master services should be injected into pods.
	MasterServiceNamespace string
	// registerSchedulable tells the kubelet to register the node as
	// schedulable. Won't have any effect if register-node is false.
	// DEPRECATED: use registerWithTaints instead
	RegisterSchedulable bool
	// This flag, if set, instructs the kubelet to keep volumes from terminated pods mounted to the node.
	// This can be useful for debugging volume related issues.
	KeepTerminatedPodVolumes bool
	// SeccompDefault enables the use of `RuntimeDefault` as the default seccomp profile for all workloads on the node.
	// To use this flag, the corresponding SeccompDefault feature gate must be enabled.
	SeccompDefault bool

KubeletFlags contains configuration flags for the Kubelet. A configuration field should go in KubeletFlags instead of KubeletConfiguration if any of these are true:

  • its value will never, or cannot safely be changed during the lifetime of a node, or
  • its value cannot be safely shared between nodes at the same time (e.g. a hostname); KubeletConfiguration is intended to be shared between nodes.

In general, please try to avoid adding flags or configuration fields, we already have a confusingly large amount of them.

func NewKubeletFlags added in v1.8.0

func NewKubeletFlags() *KubeletFlags

NewKubeletFlags will create a new KubeletFlags with default values

func (*KubeletFlags) AddFlags added in v1.7.0

func (f *KubeletFlags) AddFlags(mainfs *pflag.FlagSet)

AddFlags adds flags for a specific KubeletFlags to the specified FlagSet

type KubeletServer

type KubeletServer struct {

KubeletServer encapsulates all of the parameters necessary for starting up a kubelet. These can either be set via command line or directly.

func NewKubeletServer

func NewKubeletServer() (*KubeletServer, error)

NewKubeletServer will create a new KubeletServer with default values.

func (*KubeletServer) AddFlags

func (s *KubeletServer) AddFlags(fs *pflag.FlagSet)

AddFlags adds flags for a specific KubeletServer to the specified FlagSet

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL