2015-06-05 23:33:57 +00:00
|
|
|
# Configuring APIserver ports
|
|
|
|
|
|
|
|
This document describes what ports the kubernetes apiserver
|
|
|
|
may serve on and how to reach them. The audience is
|
|
|
|
cluster administrators who want to customize their cluster
|
2015-06-24 03:49:07 +00:00
|
|
|
or understand the details.
|
2015-06-05 23:33:57 +00:00
|
|
|
|
|
|
|
Most questions about accessing the cluster are covered
|
|
|
|
in [Accessing the cluster](../docs/accessing-the-cluster.md).
|
|
|
|
|
2014-11-06 00:05:06 +00:00
|
|
|
|
|
|
|
## Ports and IPs Served On
|
|
|
|
The Kubernetes API is served by the Kubernetes APIServer process. Typically,
|
|
|
|
there is one of these running on a single kubernetes-master node.
|
|
|
|
|
2015-05-06 21:54:54 +00:00
|
|
|
By default the Kubernetes APIserver serves HTTP on 2 ports:
|
2014-11-06 00:05:06 +00:00
|
|
|
1. Localhost Port
|
|
|
|
- serves HTTP
|
2015-06-24 03:49:07 +00:00
|
|
|
- default is port 8080, change with `--insecure-port` flag.
|
|
|
|
- defaults IP is localhost, change with `--insecure-bind-address` flag.
|
2014-11-06 00:05:06 +00:00
|
|
|
- no authentication or authorization checks in HTTP
|
|
|
|
- protected by need to have host access
|
2015-05-06 21:54:54 +00:00
|
|
|
2. Secure Port
|
2015-06-24 03:49:07 +00:00
|
|
|
- default is port 6443, change with `--secure-port` flag.
|
|
|
|
- default IP is first non-localhost network interface, change with `--bind-address` flag.
|
|
|
|
- serves HTTPS. Set cert with `--tls-cert-file` and key with `--tls-private-key-file` flag.
|
2015-04-17 21:04:14 +00:00
|
|
|
- uses token-file or client-certificate based [authentication](./authentication.md).
|
2014-11-06 00:05:06 +00:00
|
|
|
- uses policy-based [authorization](./authorization.md).
|
2015-05-06 21:54:54 +00:00
|
|
|
3. Removed: ReadOnly Port
|
|
|
|
- For security reasons, this had to be removed. Use the service account feature instead.
|
2014-11-06 00:05:06 +00:00
|
|
|
|
|
|
|
## Proxies and Firewall rules
|
|
|
|
|
2015-04-17 21:04:14 +00:00
|
|
|
Additionally, in some configurations there is a proxy (nginx) running
|
2014-11-06 00:05:06 +00:00
|
|
|
on the same machine as the apiserver process. The proxy serves HTTPS protected
|
2015-04-17 21:04:14 +00:00
|
|
|
by Basic Auth on port 443, and proxies to the apiserver on localhost:8080. In
|
|
|
|
these configurations the secure port is typically set to 6443.
|
|
|
|
|
|
|
|
A firewall rule is typically configured to allow external HTTPS access to port 443.
|
2014-11-06 00:05:06 +00:00
|
|
|
|
|
|
|
The above are defaults and reflect how Kubernetes is deployed to GCE using
|
|
|
|
kube-up.sh. Other cloud providers may vary.
|
|
|
|
|
|
|
|
## Use Cases vs IP:Ports
|
|
|
|
|
|
|
|
There are three differently configured serving ports because there are a
|
|
|
|
variety of uses cases:
|
|
|
|
1. Clients outside of a Kubernetes cluster, such as human running `kubectl`
|
|
|
|
on desktop machine. Currently, accesses the Localhost Port via a proxy (nginx)
|
2015-04-17 21:04:14 +00:00
|
|
|
running on the `kubernetes-master` machine. Proxy uses bearer token authentication.
|
2014-11-06 00:05:06 +00:00
|
|
|
2. Processes running in Containers on Kubernetes that need to do read from
|
2015-05-06 21:54:54 +00:00
|
|
|
the apiserver. Currently, these can use a service account.
|
2014-11-06 00:05:06 +00:00
|
|
|
3. Scheduler and Controller-manager processes, which need to do read-write
|
2015-05-06 21:54:54 +00:00
|
|
|
API operations. Currently, these have to run on the operations on the
|
|
|
|
apiserver. Currently, these have to run on the same host as the
|
|
|
|
apiserver and use the Localhost Port. In the future, these will be
|
|
|
|
switched to using service accounts to avoid the need to be co-located.
|
2015-04-17 21:04:14 +00:00
|
|
|
4. Kubelets, which need to do read-write API operations and are necessarily
|
|
|
|
on different machines than the apiserver. Kubelet uses the Secure Port
|
2015-02-12 16:35:49 +00:00
|
|
|
to get their pods, to find the services that a pod can see, and to
|
|
|
|
write events. Credentials are distributed to kubelets at cluster
|
|
|
|
setup time.
|
2014-11-06 00:05:06 +00:00
|
|
|
|
2015-02-12 16:35:49 +00:00
|
|
|
## Expected changes
|
|
|
|
- Policy will limit the actions kubelets can do via the authed port.
|
2015-04-17 21:04:14 +00:00
|
|
|
- Kubelets will change from token-based authentication to cert-based-auth.
|
2014-11-06 00:05:06 +00:00
|
|
|
- Scheduler and Controller-manager will use the Secure Port too. They
|
|
|
|
will then be able to run on different machines than the apiserver.
|
|
|
|
- A general mechanism will be provided for [giving credentials to
|
|
|
|
pods](
|
|
|
|
https://github.com/GoogleCloudPlatform/kubernetes/issues/1907).
|
|
|
|
- Clients, like kubectl, will all support token-based auth, and the
|
|
|
|
Localhost will no longer be needed, and will not be the default.
|
|
|
|
However, the localhost port may continue to be an option for
|
|
|
|
installations that want to do their own auth proxy.
|
2015-05-14 22:12:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/accessing_the_api.md?pixel)]()
|