mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 18:24:07 +00:00
Clarify description/usage of --advertise-address, Master.PublicAddress
This commit is contained in:
parent
085a48a70e
commit
934c553c04
@ -494,9 +494,10 @@ EOF
|
|||||||
token-url = ${TOKEN_URL}
|
token-url = ${TOKEN_URL}
|
||||||
project-id = ${PROJECT_ID}
|
project-id = ${PROJECT_ID}
|
||||||
EOF
|
EOF
|
||||||
|
EXTERNAL_IP=$(curl --fail --silent -H 'Metadata-Flavor: Google' "http://metadata/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip")
|
||||||
cat <<EOF >>/etc/salt/minion.d/grains.conf
|
cat <<EOF >>/etc/salt/minion.d/grains.conf
|
||||||
cloud_config: /etc/gce.conf
|
cloud_config: /etc/gce.conf
|
||||||
advertise_address: '${KUBERNETES_MASTER_NAME}'
|
advertise_address: '${EXTERNAL_IP}'
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@
|
|||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|
||||||
{% set params = address + " " + etcd_servers + " " + cloud_provider + " " + cloud_config + " " + runtime_config + " " + admission_control + " " + service_cluster_ip_range + " " + client_ca_file + " " + basic_auth_file -%}
|
{% set params = address + " " + etcd_servers + " " + cloud_provider + " " + cloud_config + " " + runtime_config + " " + admission_control + " " + service_cluster_ip_range + " " + client_ca_file + " " + basic_auth_file -%}
|
||||||
{% set params = params + " " + cluster_name + " " + cert_file + " " + key_file + " --secure_port=" + secure_port + " " + token_auth_file + " " + publicAddressOverride + " " + pillar['log_level'] + " " + advertise_address -%}
|
{% set params = params + " " + cluster_name + " " + cert_file + " " + key_file + " --secure_port=" + secure_port + " " + token_auth_file + " " + bind_address + " " + pillar['log_level'] + " " + advertise_address -%}
|
||||||
|
|
||||||
{
|
{
|
||||||
"apiVersion": "v1beta3",
|
"apiVersion": "v1beta3",
|
||||||
|
@ -151,8 +151,9 @@ func (s *APIServer) AddFlags(fs *pflag.FlagSet) {
|
|||||||
"clients. If blank, all interfaces will be used (0.0.0.0).")
|
"clients. If blank, all interfaces will be used (0.0.0.0).")
|
||||||
fs.Var(&s.AdvertiseAddress, "advertise-address", ""+
|
fs.Var(&s.AdvertiseAddress, "advertise-address", ""+
|
||||||
"The IP address on which to advertise the apiserver to members of the cluster. This "+
|
"The IP address on which to advertise the apiserver to members of the cluster. This "+
|
||||||
"address must be reachable by the rest of the cluster. If blank, all interfaces will be "+
|
"address must be reachable by the rest of the cluster. If blank, the --bind-address "+
|
||||||
"used.")
|
"will be used. If --bind-address is unspecified, the host's default interface will "+
|
||||||
|
"be used.")
|
||||||
fs.Var(&s.BindAddress, "public-address-override", "DEPRECATED: see --bind-address instead")
|
fs.Var(&s.BindAddress, "public-address-override", "DEPRECATED: see --bind-address instead")
|
||||||
fs.IntVar(&s.ReadOnlyPort, "read-only-port", s.ReadOnlyPort, ""+
|
fs.IntVar(&s.ReadOnlyPort, "read-only-port", s.ReadOnlyPort, ""+
|
||||||
"The port on which to serve read-only resources. If 0, don't serve read-only "+
|
"The port on which to serve read-only resources. If 0, don't serve read-only "+
|
||||||
@ -240,6 +241,13 @@ func newEtcd(etcdConfigFile string, etcdServerList util.StringList, storageVersi
|
|||||||
func (s *APIServer) Run(_ []string) error {
|
func (s *APIServer) Run(_ []string) error {
|
||||||
s.verifyClusterIPFlags()
|
s.verifyClusterIPFlags()
|
||||||
|
|
||||||
|
// If advertise-address is not specified, use bind-address. If bind-address
|
||||||
|
// is also unset (or 0.0.0.0), setDefaults() in pkg/master/master.go will
|
||||||
|
// do the right thing and use the host's default interface.
|
||||||
|
if s.AdvertiseAddress == nil || net.IP(s.AdvertiseAddress).IsUnspecified() {
|
||||||
|
s.AdvertiseAddress = s.BindAddress
|
||||||
|
}
|
||||||
|
|
||||||
if (s.EtcdConfigFile != "" && len(s.EtcdServerList) != 0) || (s.EtcdConfigFile == "" && len(s.EtcdServerList) == 0) {
|
if (s.EtcdConfigFile != "" && len(s.EtcdServerList) != 0) || (s.EtcdConfigFile == "" && len(s.EtcdServerList) == 0) {
|
||||||
glog.Fatalf("specify either --etcd-servers or --etcd-config")
|
glog.Fatalf("specify either --etcd-servers or --etcd-config")
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ type Config struct {
|
|||||||
|
|
||||||
// PublicAddress is the IP address where members of the cluster (kubelet,
|
// PublicAddress is the IP address where members of the cluster (kubelet,
|
||||||
// kube-proxy, services, etc.) can reach the master.
|
// kube-proxy, services, etc.) can reach the master.
|
||||||
// If nil or 0.0.0.0, the first result from net.InterfaceAddrs will be used.
|
// If nil or 0.0.0.0, the host's default interface will be used.
|
||||||
PublicAddress net.IP
|
PublicAddress net.IP
|
||||||
|
|
||||||
// Control the interval that pod, node IP, and node heath status caches
|
// Control the interval that pod, node IP, and node heath status caches
|
||||||
|
Loading…
Reference in New Issue
Block a user