Documentation
¶
Overview ¶
Package kubelet implements logic needed for creating and managing kubelet instances running as containers.
Index ¶
Constants ¶
View Source
const (
// DefaultHairpinMode is a default HairpinMode configured for kubelets.
DefaultHairpinMode = "hairpin-veth"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Kubelet ¶
type Kubelet struct { // Address controls, on which IP address kubelet should listen on and which IP address // should be used as NodeIP in Node object. Address string `json:"address,omitempty"` // Image allows to set Docker image with tag, which will be used by kubelet. // if they have no image set. If empty, hyperkube image defined in pkg/defaults // will be used. // // Example value: 'k8s.gcr.io/hyperkube:v1.18.3'. // // This field is optional. Image string `json:"image,omitempty"` // Host describes on which machine kubelet container should be created. // // This field is required. Host host.Host `json:"host,omitempty"` // BootstrapConfig contains kubelet bootstrap kubeconfig configuration, including // bootstrap token and Kubernetes API server address. // // This field is required. BootstrapConfig *client.Config `json:"bootstrapConfig,omitempty"` // KubernetesCACertificate holds Kubernetes X.509 CA certificate, PEM encoded, which will // be used by kubelet to verify Kubernetes API server they talk to. KubernetesCACertificate types.Certificate `json:"kubernetesCACertificate,omitempty"` // ClusterDNSIPs is a list of IP addresses, which will be used in pods for as DNS servers // to allow cluster names resolution. This is usually set to 10th address of service CIDR, // so if your service CIDR is 11.0.0.0/16, it should be 11.0.0.10. // // Example value: '11.0.0.10'. ClusterDNSIPs []string `json:"clusterDNSIPs,omitempty"` // Name defines what name should be used by kubelet while registering Node object. Name string `json:"name,omitempty"` // Taints is a list of taints, which should be set for Node object, when kubelet registers // to the Kubernetes API. Taints map[string]string `json:"taints,omitempty"` // Labels is a list of labels, which should be used when kubelet registers Node object into // cluster. Labels map[string]string `json:"labels,omitempty"` // PrivilegedLabels is a list of labels, which kubelet cannot apply by itself due to node // isolation restrictions, but administrator wants to set them. One of such labels is // 'node-role.kubernetes.io/master', which gives node a master role, which attract pods // which has access to cluster secrets, like kube-apiserver etc. PrivilegedLabels map[string]string `json:"privilegedLabels,omitempty"` // AdminConfig is a simplified version of kubeconfig, which will be used for applying // privileged labels while the pool is created/updated. AdminConfig *client.Config `json:"adminConfig,omitempty"` // CgroupDriver configures cgroup driver to be used by the kubelet. It must be the same // as configured for container runtime used by the kubelet. CgroupDriver string `json:"cgroupDriver,omitempty"` // SystemReserved configures, how much resources kubelet should mark as used by the operating // system. SystemReserved map[string]string `json:"systemReserved,omitempty"` // KubeReserved configures, how much resources kubelet should mark as used by the Kubernetes // itself on the node. KubeReserved map[string]string `json:"kubeReserved,omitempty"` // HairpinMode controls kubelet hairpin mode. HairpinMode string `json:"hairpinMode,omitempty"` // VolumePluginDir configures, where Flexvolume plugins should be installed. It will be used // unless kubelet instance define it's own VolumePluginDir. VolumePluginDir string `json:"volumePluginDir,omitempty"` // ExtraMounts defines extra mounts from host filesystem, which should be added to kubelet // containers. It will be used unless kubelet instance define it's own extra mounts. ExtraMounts []containertypes.Mount `json:"extraMounts,omitempty"` // WaitForNodeReady controls, if deploy should wait until node becomes ready. WaitForNodeReady bool `json:"waitForNodeReady,omitempty"` // ExtraArgs defines additional flags which will be added to the kubelet process. ExtraArgs []string `json:"extraArgs,omitempty"` }
Kubelet represents configuration of single kubelet instance.
type Pool ¶
type Pool struct { // Image allows to set Docker image with tag, which will be used by all kubelets, // if they have no image set. If empty, hyperkube image defined in pkg/defaults // will be used. // // Example value: 'k8s.gcr.io/hyperkube:v1.18.3'. // // This field is optional. Image string `json:"image,omitempty"` // SSH stores common SSH configuration for all kubelets and will be merged with kubelets // SSH configuration. If kubelet has some SSH fields defined, they take precedence over // this block. // // If you use same username or port for all members, it is recommended to have it defined // here to avoid repetition in the configuration. // // This field is optional. SSH *ssh.Config `json:"ssh,omitempty"` // BootstrapConfig contains kubelet bootstrap kubeconfig configuration, including // bootstrap token and Kubernetes API server address. // // This field is optional, if each kubelet instance has this field set. BootstrapConfig *client.Config `json:"bootstrapConfig,omitempty"` // Kubelets holds a list of kubelet instances to create. Kubelets []Kubelet `json:"kubelets,omitempty"` // KubernetesCACertificate holds Kubernetes X.509 CA certificate, PEM encoded, which will // be used by kubelets to verify Kubernetes API server they talk to. KubernetesCACertificate types.Certificate `json:"kubernetesCACertificate,omitempty"` // ClusterDNSIPs is a list of IP addresses, which will be used in pods for as DNS servers // to allow cluster names resolution. This is usually set to 10th address of service CIDR, // so if your service CIDR is 11.0.0.0/16, it should be 11.0.0.10. // // Example value: '11.0.0.10'. ClusterDNSIPs []string `json:"clusterDNSIPs,omitempty"` // Taints is a list of taints, which should be set for all kubelets. Taints map[string]string `json:"taints,omitempty"` // Labels is a list of labels, which should be used when kubelet registers Node object into // cluster. Labels map[string]string `json:"labels,omitempty"` // PrivilegedLabels is a list of labels, which kubelet cannot apply by itself due to node // isolation restrictions, but administrator wants to set them. One of such labels is // 'node-role.kubernetes.io/master', which gives node a master role, which attract pods // which has access to cluster secrets, like kube-apiserver etc. PrivilegedLabels map[string]string `json:"privilegedLabels,omitempty"` // AdminConfig is a simplified version of kubeconfig, which will be used for applying // privileged labels while the pool is created/updated. AdminConfig *client.Config `json:"adminConfig,omitempty"` // CgroupDriver configures cgroup driver to be used by the kubelet. It must be the same // as configured for container runtime used by the kubelet. CgroupDriver string `json:"cgroupDriver,omitempty"` // SystemReserved configures, how much resources kubelet should mark as used by the operating // system. SystemReserved map[string]string `json:"systemReserved,omitempty"` // KubeReserved configures, how much resources kubelet should mark as used by the Kubernetes // itself on the node. KubeReserved map[string]string `json:"kubeReserved,omitempty"` // HairpinMode controls kubelet hairpin mode. HairpinMode string `json:"hairpinMode,omitempty"` // VolumePluginDir configures, where Flexvolume plugins should be installed. It will be used // unless kubelet instance define it's own VolumePluginDir. VolumePluginDir string `json:"volumePluginDir,omitempty"` // ExtraMounts defines extra mounts from host filesystem, which should be added to kubelet // containers. It will be used unless kubelet instance define it's own extra mounts. ExtraMounts []containertypes.Mount `json:"extraMounts,omitempty"` // PKI field allows to use PKI resource for managing all kubernetes certificates. It will be // used for kubelets configuration, if they don't have certificates defined. PKI *pki.PKI `json:"pki,omitempty"` // Serializable fields. State container.ContainersState `json:"state,omitempty"` // WaitForNodeReady controls, if deploy should wait until node becomes ready. WaitForNodeReady bool `json:"waitForNodeReady,omitempty"` // ExtraArgs defines additional flags which will be added to the kubelet process. ExtraArgs []string `json:"extraArgs,omitempty"` }
Pool represents group of kubelet instances and their configuration.
It implements types.ResourceConfig interface and via types.Resource interface which allows to manage full lifecycle of all kubelet processes on the cluster.
It handles updating kubelet version, updating configuration and used flags. It also allows to set "privileged" Node labels like 'node-role.kubernetes.io/master', which kubelet cannot set by itself.
Click to show internal directories.
Click to hide internal directories.