Skip to content

Commit

Permalink
fix: ignore virtual IP as kubelet node IPs
Browse files Browse the repository at this point in the history
As now Talos picks up node IPs by default, we need to make sure kubelet
never picks up the VIP as the node IP.

This issue doesn't show up with HA control plane nodes, as Talos
releases VIP when kubelet restarts, but with single-node control plane
nodes VIP stays on the node (as there's nowhere to  move it to), so we
need to filter the VIP out.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
  • Loading branch information
smira committed Nov 17, 2021
1 parent 030fd34 commit 2d11b59
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/app/machined/pkg/system/services/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ func newKubeletConfiguration(clusterDNS []string, dnsDomain string) *kubeletconf
}
}

//nolint:gocyclo
func (k *Kubelet) args(r runtime.Runtime) ([]string, error) {
nodename, err := r.NodeName()
if err != nil {
Expand Down Expand Up @@ -339,6 +340,13 @@ func (k *Kubelet) args(r runtime.Runtime) ([]string, error) {
validSubnets = append(validSubnets, "!"+cidr)
}

// filter out any virtual IPs, they can't be node IPs either
for _, device := range r.Config().Machine().Network().Devices() {
if device.VIPConfig() != nil {
validSubnets = append(validSubnets, "!"+device.VIPConfig().IP())
}
}

nodeIPs, err := pickNodeIPs(validSubnets)
if err != nil {
return nil, err
Expand Down

0 comments on commit 2d11b59

Please sign in to comment.