Replace hostname -f with uname -n

This commit is contained in:
Kenjiro Nakayama 2015-04-07 01:22:06 +09:00 committed by Dawn Chen
parent 996ded35ff
commit 2e702b0c61
8 changed files with 8 additions and 14 deletions

View File

@ -31,7 +31,7 @@ log_level: debug
log_level_logfile: debug
EOF
hostnamef=$(hostname -f)
hostnamef=$(uname -n)
apt-get install -y ipcalc
netmask=$(ipcalc $MINION_IP_RANGE | grep Netmask | awk '{ print $2 }')
network=$(ipcalc $MINION_IP_RANGE | grep Address | awk '{ print $2 }')

View File

@ -36,7 +36,7 @@ if [ "$cert_ip" == "_use_aws_external_ip_" ]; then
fi
if [ "$cert_ip" == "_use_azure_dns_name_" ]; then
cert_ip=$(hostname -f | awk -F. '{ print $2 }').cloudapp.net
cert_ip=$(uname -n | awk -F. '{ print $2 }').cloudapp.net
use_cn=true
fi

View File

@ -47,7 +47,7 @@ $ export KUBERNETES_MASTER=http://${servicehost}:8888
Start etcd and verify that it is running:
```bash
$ sudo docker run -d --hostname $(hostname -f) --name etcd -p 4001:4001 -p 7001:7001 coreos/etcd
$ sudo docker run -d --hostname $(uname -n) --name etcd -p 4001:4001 -p 7001:7001 coreos/etcd
```
```bash

View File

@ -15,7 +15,7 @@ There are 4 ways that a container manifest can be provided to the Kubelet:
File Path passed as a flag on the command line. This file is rechecked every 20 seconds (configurable with a flag).
HTTP endpoint HTTP endpoint passed as a parameter on the command line. This endpoint is checked every 20 seconds (also configurable with a flag).
etcd server The Kubelet will reach out and do a watch on an etcd server. The etcd path that is watched is /registry/hosts/$(hostname -f). As this is a watch, changes are noticed and acted upon very quickly.
etcd server The Kubelet will reach out and do a watch on an etcd server. The etcd path that is watched is /registry/hosts/$(uname -n). As this is a watch, changes are noticed and acted upon very quickly.
HTTP server The kubelet can also listen for HTTP and respond to a simple API (underspec'd currently) to submit a new manifest.

View File

@ -21,7 +21,7 @@ There are 4 ways that a container manifest can be provided to the Kubelet:
.nf
File Path passed as a flag on the command line. This file is rechecked every 20 seconds (configurable with a flag).
HTTP endpoint HTTP endpoint passed as a parameter on the command line. This endpoint is checked every 20 seconds (also configurable with a flag).
etcd server The Kubelet will reach out and do a watch on an etcd server. The etcd path that is watched is /registry/hosts/\$(hostname \-f). As this is a watch, changes are noticed and acted upon very quickly.
etcd server The Kubelet will reach out and do a watch on an etcd server. The etcd path that is watched is /registry/hosts/\$(uname \-n). As this is a watch, changes are noticed and acted upon very quickly.
HTTP server The kubelet can also listen for HTTP and respond to a simple API (underspec'd currently) to submit a new manifest.
.fi

View File

@ -63,7 +63,7 @@ Key | Value
`cbr-cidr` | (Optional) The minion IP address range used for the docker container bridge.
`cloud` | (Optional) Which IaaS platform is used to host kubernetes, *gce*, *azure*, *aws*, *vagrant*
`etcd_servers` | (Optional) Comma-delimited list of IP addresses the kube-apiserver and kubelet use to reach etcd. Uses the IP of the first machine in the kubernetes_master role, or 127.0.0.1 on GCE.
`hostnamef` | (Optional) The full host name of the machine, i.e. hostname -f (only used on Azure)
`hostnamef` | (Optional) The full host name of the machine, i.e. uname -n
`node_ip` | (Optional) The IP address to use to address this node
`minion_ip` | (Optional) Mapped to the kubelet hostname_override, K8S TODO - change this name
`network_mode` | (Optional) Networking model to use among nodes: *openvswitch*

View File

@ -452,10 +452,7 @@ func fqdnSuffix() (string, error) {
if err != nil {
return "", err
}
hostname, err := exec.Command("hostname").Output()
if err != nil {
return "", err
}
hostname := strings.Split(string(fullHostname), ".")[0]
return strings.TrimSpace(string(fullHostname)[len(string(hostname)):]), nil
}
@ -469,9 +466,6 @@ func (gce *GCECloud) List(filter string) ([]string, error) {
if err != nil {
return []string{}, err
}
if len(suffix) > 0 {
suffix = "." + suffix
}
listCall := gce.service.Instances.List(gce.projectID, gce.zone)
if len(filter) > 0 {
listCall = listCall.Filter("name eq " + filter)

View File

@ -28,7 +28,7 @@ func GetHostname(hostnameOverride string) string {
if string(hostname) == "" {
// Note: We use exec here instead of os.Hostname() because we
// want the FQDN, and this is the easiest way to get it.
fqdn, err := exec.Command("hostname", "-f").Output()
fqdn, err := exec.Command("uname", "-n").Output()
if err != nil {
glog.Fatalf("Couldn't determine hostname: %v", err)
}