Skip to content

Use KubeletServer.NodeIP instead of KubeletServer.HostnameOverride to set node IP #6310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 66 additions & 2 deletions Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubelet/kubelet.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions contrib/completions/bash/openshift
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ _openshift_start_kubernetes_kubelet()
flags+=("--minimum-container-ttl-duration=")
flags+=("--network-plugin=")
flags+=("--network-plugin-dir=")
flags+=("--node-ip=")
flags+=("--node-status-update-frequency=")
flags+=("--oom-score-adj=")
flags+=("--pod-cidr=")
Expand Down
12 changes: 6 additions & 6 deletions pkg/cmd/server/kubernetes/node_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ func BuildKubernetesNodeConfig(options configapi.NodeConfig) (*NodeConfig, error
server.Config = path
server.RootDirectory = options.VolumeDirectory

// kubelet finds the node IP address by doing net.ParseIP(hostname) and if that fails,
// it does net.LookupIP(NodeName) and picks the first non-loopback address.
// Pass node IP as hostname to make kubelet use the desired IP address.
if len(options.NodeIP) > 0 {
server.HostnameOverride = options.NodeIP
} else {
server.HostnameOverride = options.NodeName
nodeIP := net.ParseIP(options.NodeIP)
if nodeIP == nil {
return nil, fmt.Errorf("Invalid Node IP: %s", options.NodeIP)
}
server.NodeIP = nodeIP
}
server.HostnameOverride = options.NodeName
server.AllowPrivileged = true
server.RegisterNode = true
server.Address = kubeAddress
Expand Down