Update kubeadm guide and reference pages for 1.6
Signed-off-by: Joe Beda <joe.github@bedafamily.com>
This commit is contained in:
+271
-154
@@ -13,127 +13,137 @@ Running `kubeadm init` bootstraps a Kubernetes cluster. This consists of the
|
|||||||
following steps:
|
following steps:
|
||||||
|
|
||||||
1. kubeadm runs a series of pre-flight checks to validate the system state
|
1. kubeadm runs a series of pre-flight checks to validate the system state
|
||||||
before making changes. Some checks only trigger warnings, others are
|
before making changes. Some checks only trigger warnings, others are
|
||||||
considered errors and will exit kubeadm until the problem is corrected or
|
considered errors and will exit kubeadm until the problem is corrected or the
|
||||||
the user specifies `--skip-preflight-checks`.
|
user specifies `--skip-preflight-checks`.
|
||||||
|
|
||||||
1. kubeadm generates a token that additional nodes can use to register
|
1. kubeadm generates a token that additional nodes can use to register
|
||||||
themselves with the master in future. Optionally, the user can provide a token.
|
themselves with the master in future. Optionally, the user can provide a
|
||||||
|
token.
|
||||||
|
|
||||||
1. kubeadm generates a self-signed CA using openssl to provision identities
|
1. kubeadm generates a self-signed CA to provision identities for each component
|
||||||
for each node in the cluster, and for the API server to secure communication
|
(including nodes) in the cluster. It also generates client certificates to
|
||||||
with clients.
|
be used by various components.
|
||||||
|
|
||||||
1. Outputting a kubeconfig file for the kubelet to use to connect to the API
|
1. Outputting a kubeconfig file for the kubelet to use to connect to the API
|
||||||
server, as well as an additional kubeconfig file for administration.
|
server, as well as an additional kubeconfig file for administration.
|
||||||
|
|
||||||
1. kubeadm generates Kubernetes resource manifests for the API server,
|
1. kubeadm generates Kubernetes Static Pod manifests for the API server,
|
||||||
controller manager and scheduler, and placing them in
|
controller manager and scheduler. It places them in
|
||||||
`/etc/kubernetes/manifests`. The kubelet watches this directory for static
|
`/etc/kubernetes/manifests`. The kubelet watches this directory for Pods to
|
||||||
resources to create on startup. These are the core components of Kubernetes, and
|
create on startup. These are the core components of Kubernetes. Once they are
|
||||||
once they are up and running we can use `kubectl` to set up or manage any
|
up and running kubeadm can set up and manage any additional components.
|
||||||
additional components.
|
|
||||||
|
|
||||||
1. kubeadm installs some add-on components, such as DNS or discovery, via the API
|
1. kubeadm "taints" the master node so that only control plane components will
|
||||||
server.
|
run there. It also sets up the RBAC authorization system and writes a
|
||||||
|
special ConfigMap that is used to bootstrap trust with the kubelets.
|
||||||
|
|
||||||
Running `kubeadm join` on each node in the cluster consists of the following steps:
|
1. kubeadm installs installs add-on components via the API server. Right now
|
||||||
|
this is the internal DNS server and the kube-proxy DaemonSet.
|
||||||
|
|
||||||
1. Use the token to talk to the API server and securely get the root CA
|
Running `kubeadm join` on each node in the cluster consists of the following
|
||||||
certificate.
|
steps:
|
||||||
|
|
||||||
1. Creates a local key pair. Prepares a certificate signing request (CSR) and
|
1. kubeadm downloads root CA information from the API server. It uses the token
|
||||||
sends that off to the API server for signing.
|
to verify the authenticity of that data.
|
||||||
|
|
||||||
1. Configures the local kubelet to connect to the API server
|
1. kubeadm creates a local key pair. It prepares a certificate signing request
|
||||||
|
(CSR) and sends that off to the API server for signing. The bootstrap token
|
||||||
|
is used to authenticate. The API server is configured to sign this
|
||||||
|
automatically.
|
||||||
|
|
||||||
|
1. kubeadm configures the local kubelet to connect to the API server
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Fields that support multiple values do so either with comma separation, or by specifying
|
Fields that support multiple values do so either with comma separation, or by
|
||||||
the flag multiple times.
|
specifying the flag multiple times.
|
||||||
|
|
||||||
|
The kubeadm command line interface is currently in **beta**. We are aiming to
|
||||||
|
not break any scripted use of the main `kubeadm init` and `kubeadm join`. The
|
||||||
|
single exception here is the format of the kubeadm config file as detailed
|
||||||
|
below. That format is still considered alpha and may change.
|
||||||
|
|
||||||
### `kubeadm init`
|
### `kubeadm init`
|
||||||
|
|
||||||
It is usually sufficient to run `kubeadm init` without any flags,
|
It is usually sufficient to run `kubeadm init` without any flags, but in some
|
||||||
but in some cases you might like to override the default behaviour.
|
cases you might like to override the default behaviour. Here we specify all the
|
||||||
Here we specify all the flags that can be used to customise the Kubernetes
|
flags that can be used to customise the Kubernetes installation.
|
||||||
installation.
|
|
||||||
|
|
||||||
- `--api-advertise-addresses` (multiple values are allowed)
|
- `--api-advertise-address`
|
||||||
- `--api-external-dns-names` (multiple values are allowed)
|
|
||||||
|
|
||||||
By default, `kubeadm init` automatically detects IP addresses and uses
|
This is the address the API Server will advertise to other members of the
|
||||||
these to generate certificates for the API server. This uses the IP address
|
cluster. This is also the address used to construct the suggested `kubeadm
|
||||||
of the default network interface. If you would like to access the API server
|
join` line at the end of the init process. If not set (or set to 0.0.0.0) then
|
||||||
through a different IP address, or through a hostname, you can override these
|
IP for the default interface will be used.
|
||||||
defaults with `--api-advertise-addresses` and `--api-external-dns-names`.
|
|
||||||
For example, to generate certificates that verify the API server at addresses
|
|
||||||
`10.100.245.1` and `100.123.121.1`, you could use
|
|
||||||
`--api-advertise-addresses=10.100.245.1,100.123.121.1`. To allow it to be accessed
|
|
||||||
with a hostname, `--api-external-dns-names=kubernetes.example.com,kube.example.com`
|
|
||||||
Specifying `--api-advertise-addresses` disables auto detection of IP addresses.
|
|
||||||
|
|
||||||
- `--cloud-provider`
|
This address is also added to the certifcate that the API Server uses.
|
||||||
|
|
||||||
Currently, `kubeadm init` does not provide autodetection of cloud provider.
|
- `--apiserver-bind-port`
|
||||||
This means that load balancing and persistent volumes are not supported out
|
|
||||||
of the box. You can specify a cloud provider using `--cloud-provider`.
|
|
||||||
Valid values are the ones supported by `controller-manager`, namely `"aws"`,
|
|
||||||
`"azure"`, `"cloudstack"`, `"gce"`, `"mesos"`, `"openstack"`, `"ovirt"`,
|
|
||||||
`"rackspace"`, `"vsphere"`. In order to provide additional configuration for
|
|
||||||
the cloud provider, you should create a `/etc/kubernetes/cloud-config`
|
|
||||||
file manually, before running `kubeadm init`. `kubeadm` automatically
|
|
||||||
picks those settings up and ensures other nodes are configured correctly.
|
|
||||||
The exact format and content of the file `/etc/kubernetes/cloud-config` depends
|
|
||||||
on the type you specified for `--cloud-provider`; see the appropriate documentation
|
|
||||||
for your cloud provider for details.
|
|
||||||
You must also set the `--cloud-provider` and `--cloud-config` parameters
|
|
||||||
yourself by editing the `/etc/systemd/system/kubelet.service.d/10-kubeadm.conf`
|
|
||||||
file appropriately.
|
|
||||||
|
|
||||||
- `--external-etcd-cafile` etcd certificate authority file
|
The port that the API server will bind on. This defaults to 6443.
|
||||||
- `--external-etcd-endpoints` (multiple values are allowed)
|
|
||||||
- `--external-etcd-certfile` etcd client certificate file
|
|
||||||
- `--external-etcd-keyfile` etcd client key file
|
|
||||||
|
|
||||||
By default, `kubeadm` deploys a single node etcd cluster on the master
|
- `--apiserver-cert-extra-sans`
|
||||||
to store Kubernetes state. This means that any failure on the master node
|
|
||||||
requires you to rebuild your cluster from scratch. Currently `kubeadm init`
|
Additional hostnames or IP addresses that should be added to the Subject
|
||||||
does not support automatic deployment of a highly available etcd cluster.
|
Alternate Name section for the certificate that the API Server will use. If you
|
||||||
If you would like to use your own etcd cluster, you can override this
|
expose the API Server through a load balancer and public DNS you could specify
|
||||||
behaviour with `--external-etcd-endpoints`. `kubeadm` supports etcd client
|
this with
|
||||||
authentication using the `--external-etcd-cafile`, `--external-etcd-certfile`
|
|
||||||
and `--external-etcd-keyfile` flags.
|
```
|
||||||
|
--apiserver-cert-extra-sans=kubernetes.example.com,kube.example.com,10.100.245.1
|
||||||
|
```
|
||||||
|
|
||||||
|
- `--cert-dir`
|
||||||
|
|
||||||
|
The path where to save and store the certificates. The default is
|
||||||
|
"/etc/kubernetes/pki".
|
||||||
|
|
||||||
|
- `--config`
|
||||||
|
|
||||||
|
A kubeadm specific [config file](#config-file). This can be used to specify an
|
||||||
|
extended set of options including passing arbitrary command line flags to the
|
||||||
|
control plane components.
|
||||||
|
|
||||||
|
- `--kubernetes-version` (default 'latest') the kubernetes version to initialise
|
||||||
|
|
||||||
|
The **v1.6** version of kubeadm only supports building clusters that are at
|
||||||
|
least **v1.6.0**. There are many reasons for this including kubeadm's use of
|
||||||
|
RBAC, the Bootstrap Token system, and enhancements to the Certificates API. With
|
||||||
|
this flag you can try any future version of Kubernetes. Check [releases
|
||||||
|
page](https://github.com/kubernetes/kubernetes/releases) for a full list of
|
||||||
|
available versions.
|
||||||
|
|
||||||
- `--pod-network-cidr`
|
- `--pod-network-cidr`
|
||||||
|
|
||||||
For certain networking solutions the Kubernetes master can also play a role in
|
For certain networking solutions the Kubernetes master can also play a role in
|
||||||
allocating network ranges (CIDRs) to each node. This includes many cloud providers
|
allocating network ranges (CIDRs) to each node. This includes many cloud
|
||||||
and flannel. You can specify a subnet range that will be broken down and handed out
|
providers and flannel. You can specify a subnet range that will be broken down
|
||||||
to each node with the `--pod-network-cidr` flag. This should be a minimum of a /16 so
|
and handed out to each node with the `--pod-network-cidr` flag. This should be a
|
||||||
controller-manager is able to assign /24 subnets to each node in the cluster.
|
minimum of a /16 so controller-manager is able to assign /24 subnets to each
|
||||||
If you are using flannel with [this manifest](https://github.com/coreos/flannel/blob/master/Documentation/kube-flannel.yml)
|
node in the cluster. If you are using flannel with [this
|
||||||
you should use `--pod-network-cidr=10.244.0.0/16`. Most CNI based networking solutions
|
manifest](https://github.com/coreos/flannel/blob/master/Documentation/kube-flannel.yml)
|
||||||
do not require this flag.
|
you should use `--pod-network-cidr=10.244.0.0/16`. Most CNI based networking
|
||||||
|
solutions do not require this flag.
|
||||||
|
|
||||||
- `--service-cidr` (default '10.96.0.0/12')
|
- `--service-cidr` (default '10.96.0.0/12')
|
||||||
|
|
||||||
You can use the `--service-cidr` flag to override the subnet Kubernetes uses to
|
You can use the `--service-cidr` flag to override the subnet Kubernetes uses to
|
||||||
assign pods IP addresses. If you do, you will also need to update the
|
assign pods IP addresses. If you do, you will also need to update the
|
||||||
`/etc/systemd/system/kubelet.service.d/10-kubeadm.conf` file to reflect this change
|
`/etc/systemd/system/kubelet.service.d/10-kubeadm.conf` file to reflect this
|
||||||
else DNS will not function correctly.
|
change else DNS will not function correctly.
|
||||||
|
|
||||||
- `--service-dns-domain` (default 'cluster.local')
|
- `--service-dns-domain` (default 'cluster.local')
|
||||||
|
|
||||||
By default, `kubeadm init` deploys a cluster that assigns services with DNS names
|
By default, `kubeadm init` deploys a cluster that assigns services with DNS
|
||||||
`<service_name>.<namespace>.svc.cluster.local`. You can use the `--service-dns-domain`
|
names `<service_name>.<namespace>.svc.cluster.local`. You can use the
|
||||||
to change the DNS name suffix. Again, you will need to update the
|
`--service-dns-domain` to change the DNS name suffix. Again, you will need to
|
||||||
`/etc/systemd/system/kubelet.service.d/10-kubeadm.conf` file accordingly else DNS will
|
update the `/etc/systemd/system/kubelet.service.d/10-kubeadm.conf` file
|
||||||
not function correctly.
|
accordingly else DNS will not function correctly.
|
||||||
|
|
||||||
- `--skip-preflight-checks`
|
- `--skip-preflight-checks`
|
||||||
|
|
||||||
By default, `kubeadm` runs a series of preflight checks to validate the system
|
By default, kubeadm runs a series of preflight checks to validate the system
|
||||||
before making any changes. Advanced users can use this flag to bypass these if
|
before making any changes. Advanced users can use this flag to bypass these if
|
||||||
necessary.
|
necessary.
|
||||||
|
|
||||||
@@ -141,43 +151,110 @@ necessary.
|
|||||||
|
|
||||||
By default, `kubeadm init` automatically generates the token used to initialise
|
By default, `kubeadm init` automatically generates the token used to initialise
|
||||||
each new node. If you would like to manually specify this token, you can use the
|
each new node. If you would like to manually specify this token, you can use the
|
||||||
`--token` flag. The token must be of the format `<6 character string>.<16 character string>`.
|
`--token` flag. The token must be of the format `[a-z0-9]{6}\.[a-z0-9]{16}`. A
|
||||||
|
compatible random token can be generated `kubeadm token generate`. Tokens can
|
||||||
|
be managed through the API after the cluster is created. See the [section on
|
||||||
|
managing tokens](#manage-tokens) below.
|
||||||
|
|
||||||
- `--kubernetes-version` (default 'latest') the kubernetes version to initialise
|
- `--token-ttl`
|
||||||
|
|
||||||
`kubeadm` was originally built for Kubernetes version **v1.4.0**, older versions are not
|
This sets an expiration time for the token. This is specified as a duration
|
||||||
supported. The current version of `kubeadm` requires at least **v1.6.0-alpha.3** due to RBAC being enabled by default.
|
from the current time. After this time the token will no longer be valid and
|
||||||
With this flag you can try any future version, e.g. **v1.6.0-beta.1**
|
will be removed. A value of 0 specifies that the token never expires. 0 is the
|
||||||
whenever it comes out (check [releases page](https://github.com/kubernetes/kubernetes/releases)
|
default. See the [section on managing tokens](#manage-tokens) below.
|
||||||
for a full list of available versions).
|
|
||||||
|
|
||||||
### `kubeadm join`
|
### `kubeadm join`
|
||||||
|
|
||||||
When you use kubeadm join, you must supply the token used to secure cluster
|
When joining a kubeadm initialized cluster, we need to establish bidirectional
|
||||||
boostrap as a mandatory flag, and the master IP address as a mandatory argument.
|
trust. This is split into discovery (having the Node trust the Kubernetes
|
||||||
|
master) and TLS bootstrap (having the Kubernetes master trust the Node).
|
||||||
|
|
||||||
|
There are 2 main schemes for discovery. The first is to use a shared token along
|
||||||
|
with the IP address of the API server. The second is to provide a file (a subset
|
||||||
|
of the standard kubeconfig file). This file can be a local file or downloaded
|
||||||
|
via an HTTPS URL. The forms are `kubeadm join --discovery-token
|
||||||
|
abcdef.1234567890abcdef 1.2.3.4:6443`, `kubeadm join --discovery-file
|
||||||
|
path/to/file.conf` or `kubeadm join --discovery-file https://url/file.conf`.
|
||||||
|
Only one form can be used. If the discovery information is loaded from a URL,
|
||||||
|
HTTPS must be used and the host installed CA bundle is used to verify the
|
||||||
|
connection.
|
||||||
|
|
||||||
|
The TLS bootstrap mechanism is also driven via a shared token. This is used to
|
||||||
|
temporarily authenticate with the Kubernetes master to submit a certificate
|
||||||
|
signing request (CSR) for a locally created key pair. By default kubeadm will
|
||||||
|
set up the Kubernetes master to automatically approve these signing requests.
|
||||||
|
This token is passed in with the `--tls-bootstrap-token abcdef.1234567890abcdef`
|
||||||
|
flag.
|
||||||
|
|
||||||
|
Often times the same token is use for both parts. In this case, the `--token` flag
|
||||||
|
can be used instead of specifying the each token individually.
|
||||||
|
|
||||||
Here's an example on how to use it:
|
Here's an example on how to use it:
|
||||||
|
|
||||||
`kubeadm join --token=the_secret_token 192.168.1.1`
|
`kubeadm join --token=abcdef.1234567890abcdef 192.168.1.1:6443`
|
||||||
|
|
||||||
|
Specific options:
|
||||||
|
|
||||||
|
- `--config`
|
||||||
|
|
||||||
|
Extended options a specified in the [kubeadm specific config file](#config-file).
|
||||||
|
|
||||||
- `--skip-preflight-checks`
|
- `--skip-preflight-checks`
|
||||||
|
|
||||||
By default, `kubeadm` runs a series of preflight checks to validate the system
|
By default, kubeadm runs a series of preflight checks to validate the system
|
||||||
before making any changes. Advanced users can use this flag to bypass these if
|
before making any changes. Advanced users can use this flag to bypass these if
|
||||||
necessary.
|
necessary.
|
||||||
|
|
||||||
|
- `--discovery-file`
|
||||||
|
|
||||||
|
A local file path or HTTPS URL. The file specified must be a kubeconfig file
|
||||||
|
with nothing but an unnamed cluster entry. This is used to find both the
|
||||||
|
location of the API server to join along with a root CA bundle to use when
|
||||||
|
talking to that server.
|
||||||
|
|
||||||
|
This might look something like this:
|
||||||
|
|
||||||
|
``` yaml
|
||||||
|
apiVersion: v1
|
||||||
|
clusters:
|
||||||
|
- cluster:
|
||||||
|
certificate-authority-data: <really long certificate data>
|
||||||
|
server: https://10.138.0.2:6443
|
||||||
|
name: ""
|
||||||
|
contexts: []
|
||||||
|
current-context: ""
|
||||||
|
kind: Config
|
||||||
|
preferences: {}
|
||||||
|
users: []
|
||||||
|
```
|
||||||
|
|
||||||
|
- `--discovery-token`
|
||||||
|
|
||||||
|
The discovery token is used along with the address of the API server (as an
|
||||||
|
unnamed argument) to download and verify information about the cluster. The
|
||||||
|
most critical part of the cluster information is the root CA bundle used to
|
||||||
|
verify the identity of the server during subsequent TLS connections.
|
||||||
|
|
||||||
|
- `--tls-bootstrap-token`
|
||||||
|
|
||||||
|
The token used to authenticate to the API server for the purposes of TLS
|
||||||
|
bootstrapping.
|
||||||
|
|
||||||
- `--token=<token>`
|
- `--token=<token>`
|
||||||
|
|
||||||
By default, when `kubeadm init` runs, a token is generated and revealed in the output.
|
Often times the same token is used for both `--discovery-token` and
|
||||||
That's the token you should use here.
|
`--tls-bootstrap-token`. This option specifies the same token for both. Other
|
||||||
|
flags override this flag if present.
|
||||||
|
|
||||||
|
## Using kubeadm with a configuration file {#config-file}
|
||||||
|
|
||||||
## Using kubeadm with a configuration file
|
**WARNING:** While kubeadm command line interface is in beta, the config file is
|
||||||
|
still considered alpha and may change in future versions.
|
||||||
|
|
||||||
WARNING: kubeadm is in alpha and the configuration API syntax will likely change before GA.
|
It's possible to configure kubeadm with a configuration file instead of command
|
||||||
|
line flags, and some more advanced features may only be available as
|
||||||
It's possible to configure kubeadm with a configuration file instead of command line flags, and some more advanced features may only be
|
configuration file options. This file is passed in to the `--config` option on
|
||||||
available as configuration file options.
|
both `kubeadm init` and `kubeadm join`.
|
||||||
|
|
||||||
### Sample Master Configuration
|
### Sample Master Configuration
|
||||||
|
|
||||||
@@ -185,16 +262,7 @@ available as configuration file options.
|
|||||||
apiVersion: kubeadm.k8s.io/v1alpha1
|
apiVersion: kubeadm.k8s.io/v1alpha1
|
||||||
kind: MasterConfiguration
|
kind: MasterConfiguration
|
||||||
api:
|
api:
|
||||||
advertiseAddresses:
|
advertiseAddress: <address|string>
|
||||||
- <address1|string>
|
|
||||||
- <address2|string>
|
|
||||||
bindPort: <int>
|
|
||||||
externalDNSNames:
|
|
||||||
- <dnsname1|string>
|
|
||||||
- <dnsname2|string>
|
|
||||||
authorizationMode: <string>
|
|
||||||
cloudProvider: <string>
|
|
||||||
discovery:
|
|
||||||
bindPort: <int>
|
bindPort: <int>
|
||||||
etcd:
|
etcd:
|
||||||
endpoints:
|
endpoints:
|
||||||
@@ -203,25 +271,29 @@ etcd:
|
|||||||
caFile: <path|string>
|
caFile: <path|string>
|
||||||
certFile: <path|string>
|
certFile: <path|string>
|
||||||
keyFile: <path|string>
|
keyFile: <path|string>
|
||||||
kubernetesVersion: <string>
|
|
||||||
networking:
|
networking:
|
||||||
dnsDomain: <string>
|
dnsDomain: <string>
|
||||||
serviceSubnet: <cidr>
|
serviceSubnet: <cidr>
|
||||||
podSubnet: <cidr>
|
podSubnet: <cidr>
|
||||||
secrets:
|
kubernetesVersion: <string>
|
||||||
givenToken: <token|string>
|
cloudProvider: <string>
|
||||||
apiServerExtraArgs: {
|
authorizationMode: <string>
|
||||||
<argument>: <value|string>,
|
token: <string>
|
||||||
<argument>: <value|string>,
|
tokenTTL: <time duration>
|
||||||
}
|
selfHosted: <bool>
|
||||||
controllerManagerExtraArgs: {
|
apiServerExtraArgs:
|
||||||
<argument>: <value|string>,
|
<argument>: <value|string>
|
||||||
<argument>: <value|string>,
|
<argument>: <value|string>
|
||||||
}
|
controllerManagerExtraArgs:
|
||||||
schedulerExtraArgs: {
|
<argument>: <value|string>
|
||||||
<argument>: <value|string>,
|
<argument>: <value|string>
|
||||||
<argument>: <value|string>,
|
schedulerExtraArgs:
|
||||||
}
|
<argument>: <value|string>
|
||||||
|
<argument>: <value|string>
|
||||||
|
apiServerCertSANs:
|
||||||
|
- <name1|string>
|
||||||
|
- <name2|string>
|
||||||
|
certificatesDir: <string>
|
||||||
```
|
```
|
||||||
|
|
||||||
### Sample Node Configuration
|
### Sample Node Configuration
|
||||||
@@ -229,53 +301,94 @@ schedulerExtraArgs: {
|
|||||||
```yaml
|
```yaml
|
||||||
apiVersion: kubeadm.k8s.io/v1alpha1
|
apiVersion: kubeadm.k8s.io/v1alpha1
|
||||||
kind: NodeConfiguration
|
kind: NodeConfiguration
|
||||||
apiPort: <int>
|
caCertPath: <path|string>
|
||||||
discoveryPort: <int>
|
discoveryFile: <path|string>
|
||||||
masterAddresses:
|
discoveryToken: <string>
|
||||||
- <master1>
|
|
||||||
secrets:
|
# Currently only the first server is used as a target for the cluster
|
||||||
givenToken: <token|string>
|
# bootstrap flow.
|
||||||
|
discoveryTokenAPIServers:
|
||||||
|
- <address|string>
|
||||||
|
- <address|string>
|
||||||
|
|
||||||
|
tlsBootstrapToken: <string>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Managing Tokens {#manage-tokens}
|
||||||
|
|
||||||
|
You can use the `kubeadm` tool to manage tokens on a running cluster. It will
|
||||||
|
automatically grab the default admin credentials on a master from a `kubeadm`
|
||||||
|
created cluster (`/etc/kubernetes/admin.conf`). You can specify an alternate
|
||||||
|
kubeconfig file for credentials with the `--kubeconfig` to the following
|
||||||
|
commands.
|
||||||
|
|
||||||
|
* `kubeadm token list` Lists the tokens along with when they expire and what the
|
||||||
|
approved usages are.
|
||||||
|
* `kubeadm token create` Creates a new token.
|
||||||
|
* `--description` Set the description on the new token.
|
||||||
|
* `--ttl duration` Set expiration time of the token as a delta from "now".
|
||||||
|
Default is 0 for no expiration.
|
||||||
|
* `--usages` Set the ways that the token can be used. The default is
|
||||||
|
`signing,authentication`. These are the usages as described above.
|
||||||
|
* `kubeadm token delete <token id>|<token id>.<token secret>` Delete a token.
|
||||||
|
The token can either be identified with just an ID or with the entire token
|
||||||
|
value. Only the ID is used; the token is still deleted if the secret does not
|
||||||
|
match.
|
||||||
|
|
||||||
|
In addition, you can use the `kubeadm token generate` command to locally creates
|
||||||
|
a new token. This token is of the correct form for specifying with the
|
||||||
|
`--token` argument to `kubeadm init`.
|
||||||
|
|
||||||
|
For the gory details on how the tokens are implemented (including managing them
|
||||||
|
outside of kubeadm) see the [Bootstrap Token
|
||||||
|
docs](/docs/admin/bootstrap-tokens/).
|
||||||
|
|
||||||
## Automating kubeadm
|
## Automating kubeadm
|
||||||
|
|
||||||
Rather than copying the token you obtained from `kubeadm init` to each node, as
|
Rather than copying the token you obtained from `kubeadm init` to each node, as
|
||||||
in the basic `kubeadm` tutorials, you can parallelize the token distribution for
|
in the [basic kubeadm tutorial](docs/getting-started-guides/kubeadm/), you can
|
||||||
easier automation. To implement this automation, you must know the IP address
|
parallelize the token distribution for easier automation. To implement this
|
||||||
that the master will have after it is started.
|
automation, you must know the IP address that the master will have after it is
|
||||||
|
started.
|
||||||
|
|
||||||
1. Generate a token. This token must have the form `<6 character string>.<16 character string>`.
|
1. Generate a token. This token must have the form `<6 character string>.<16
|
||||||
|
character string>`. More formally, it must match the regex
|
||||||
|
`[a-z0-9]{6}\.[a-z0-9]{16}`.
|
||||||
|
|
||||||
Kubeadm can pre-generate a token for you:
|
Kubeadm can generate a token for you:
|
||||||
|
|
||||||
```console
|
``` bash
|
||||||
$ kubeadm token generate
|
kubeadm token generate
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Start both the master node and the worker nodes concurrently with this token. As they come up they should find each other and form the cluster.
|
1. Start both the master node and the worker nodes concurrently with this token.
|
||||||
|
As they come up they should find each other and form the cluster. The same
|
||||||
|
`--token` argument can be used on both `kubeadm init` and `kubeadm join`.
|
||||||
|
|
||||||
Once the cluster is up, you can grab the admin credentials from the master node at `/etc/kubernetes/admin.conf` and use that to talk to the cluster.
|
Once the cluster is up, you can grab the admin credentials from the master node
|
||||||
|
at `/etc/kubernetes/admin.conf` and use that to talk to the cluster.
|
||||||
|
|
||||||
## Environment variables
|
## Environment variables
|
||||||
|
|
||||||
There are some environment variables that modify the way that `kubeadm` works. Most users will have no need to set these.
|
There are some environment variables that modify the way that kubeadm works.
|
||||||
These environment variables are a short-term solution, eventually they will be integrated in the kubeadm configuration file.
|
Most users will have no need to set these. These environment variables are a
|
||||||
|
short-term solution, eventually they will be integrated in the kubeadm
|
||||||
|
configuration file.
|
||||||
|
|
||||||
| Variable | Default | Description |
|
| Variable | Default | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| `KUBE_KUBERNETES_DIR` | `/etc/kubernetes` | Where most configuration files are written to and read from |
|
| `KUBE_KUBERNETES_DIR` | `/etc/kubernetes` | Where most configuration files are written to and read from |
|
||||||
| `KUBE_HOST_PKI_PATH` | `/etc/kubernetes/pki` | Directory for master PKI assets |
|
|
||||||
| `KUBE_HOST_ETCD_PATH` | `/var/lib/etcd` | Local etcd state for Kubernetes cluster |
|
| `KUBE_HOST_ETCD_PATH` | `/var/lib/etcd` | Local etcd state for Kubernetes cluster |
|
||||||
| `KUBE_HYPERKUBE_IMAGE` | `` | If set, use a single hyperkube image with this name. If not set, individual images per server component will be used. |
|
| `KUBE_HYPERKUBE_IMAGE` | | If set, use a single hyperkube image with this name. If not set, individual images per server component will be used. |
|
||||||
| `KUBE_DISCOVERY_IMAGE` | `gcr.io/google_containers/kube-discovery-<arch>:1.0` | The bootstrap discovery helper image to use. |
|
| `KUBE_ETCD_IMAGE` | `gcr.io/google_containers/etcd-<arch>:3.0.17` | The etcd container image to use. |
|
||||||
| `KUBE_ETCD_IMAGE` | `gcr.io/google_containers/etcd-<arch>:2.2.5` | The etcd container image to use. |
|
|
||||||
| `KUBE_REPO_PREFIX` | `gcr.io/google_containers` | The image prefix for all images that are used. |
|
| `KUBE_REPO_PREFIX` | `gcr.io/google_containers` | The image prefix for all images that are used. |
|
||||||
|
|
||||||
If you want to use kubeadm with an http proxy, you may need to configure it to support http_proxy, https_proxy, or no_proxy.
|
If you want to use kubeadm with an http proxy, you may need to configure it to
|
||||||
|
support http_proxy, https_proxy, or no_proxy.
|
||||||
|
|
||||||
For example, if your kube master node IP address is 10.18.17.16 and you have proxy support both http/https on 10.18.17.16 port 8080, you can use the following command:
|
For example, if your kube master node IP address is 10.18.17.16 and you have a
|
||||||
|
proxy which supports both http/https on 10.18.17.16 port 8080, you can use the
|
||||||
You can using following command
|
following command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export PROXY_PORT=8080
|
export PROXY_PORT=8080
|
||||||
@@ -287,10 +400,14 @@ export HTTPS_PROXY=$http_proxy
|
|||||||
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com,example.com,10.18.17.16"
|
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com,example.com,10.18.17.16"
|
||||||
```
|
```
|
||||||
|
|
||||||
Remember to change ```proxy_ip``` and add a kube master node IP address to ```no_proxy```.
|
Remember to change `proxy_ip` and add a kube master node IP address to
|
||||||
|
`no_proxy`.
|
||||||
|
|
||||||
## Releases and release notes
|
## Releases and release notes
|
||||||
|
|
||||||
If you already have kubeadm installed and want to upgrade, run `apt-get update && apt-get upgrade` or `yum update` to get the latest version of kubeadm.
|
If you already have kubeadm installed and want to upgrade, run `apt-get update
|
||||||
|
&& apt-get upgrade` or `yum update` to get the latest version of kubeadm.
|
||||||
|
|
||||||
Refer to the [CHANGELOG.md](https://github.com/kubernetes/kubeadm/blob/master/CHANGELOG.md) for more information.
|
Refer to the
|
||||||
|
[CHANGELOG.md](https://github.com/kubernetes/kubeadm/blob/master/CHANGELOG.md)
|
||||||
|
for more information.
|
||||||
|
|||||||
@@ -13,9 +13,10 @@ li>.highlighter-rouge {position:relative; top:3px;}
|
|||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
This quickstart shows you how to easily install a secure Kubernetes cluster on
|
This quickstart shows you how to easily install a Kubernetes cluster on machines
|
||||||
machines running Ubuntu 16.04, CentOS 7 or HypriotOS v1.0.1+. The installation
|
running Ubuntu 16.04, CentOS 7 or HypriotOS v1.0.1+. The installation uses a
|
||||||
uses a tool called _kubeadm_ which is part of Kubernetes.
|
tool called _kubeadm_ which is part of Kubernetes. As of v1.6, kubeadm aims to
|
||||||
|
create a secure cluster of of the box via mechanisms such as RBAC.
|
||||||
|
|
||||||
This process works with local VMs, physical servers and/or cloud servers. It is
|
This process works with local VMs, physical servers and/or cloud servers. It is
|
||||||
simple enough that you can easily integrate its use into your own automation
|
simple enough that you can easily integrate its use into your own automation
|
||||||
@@ -24,25 +25,42 @@ simple enough that you can easily integrate its use into your own automation
|
|||||||
See the full [kubeadm reference](/docs/admin/kubeadm) for information on all
|
See the full [kubeadm reference](/docs/admin/kubeadm) for information on all
|
||||||
kubeadm command-line flags and for advice on automating kubeadm itself.
|
kubeadm command-line flags and for advice on automating kubeadm itself.
|
||||||
|
|
||||||
**The kubeadm tool is currently in alpha but please try it out and give us
|
|
||||||
[feedback](/docs/getting-started-guides/kubeadm/#feedback)! Be sure to read the
|
|
||||||
[limitations](#limitations); in particular note that kubeadm doesn't have great
|
|
||||||
support for automatically configuring cloud providers. Please refer to the
|
|
||||||
specific cloud provider documentation or use another provisioning system.**
|
|
||||||
|
|
||||||
kubeadm assumes you have a set of machines (virtual or real) that are up and
|
kubeadm assumes you have a set of machines (virtual or real) that are up and
|
||||||
running. It is designed to be part of a large provisioning system - or just for
|
running. It is designed to be part of a large provisioning system - or just for
|
||||||
easy manual provisioning. kubeadm is a great choice where you have your own
|
easy manual provisioning. kubeadm is a great choice where you have your own
|
||||||
infrastructure (e.g. bare metal), or where you have an existing orchestration
|
infrastructure (e.g. bare metal), or where you have an existing orchestration
|
||||||
system (e.g. Puppet) that you have to integrate with.
|
system (e.g. Puppet) that you have to integrate with.
|
||||||
|
|
||||||
If you are not constrained, there are some other tools built to give you
|
If you are not constrained, there are other higher-level tools built to give you
|
||||||
complete clusters:
|
complete clusters:
|
||||||
|
|
||||||
* On GCE, [Google Container Engine](https://cloud.google.com/container-engine/)
|
* On GCE, [Google Container Engine](https://cloud.google.com/container-engine/)
|
||||||
gives you one-click Kubernetes clusters
|
gives you one-click Kubernetes clusters
|
||||||
* On AWS, [kops](https://github.com/kubernetes/kops) makes cluster installation
|
* On AWS, [kops](https://github.com/kubernetes/kops) makes cluster installation
|
||||||
and management easy (and supports high availability)
|
and management easy. kops supports building high availability clusters (a
|
||||||
|
feature that kubeadm is currently lacking but is building toward).
|
||||||
|
|
||||||
|
### kubeadm Maturity
|
||||||
|
|
||||||
|
| Aspect | Maturity Level
|
||||||
|
|--------|---------------
|
||||||
|
| Command line UX | beta
|
||||||
|
| Config file | alpha
|
||||||
|
| Selfhosting | alpha
|
||||||
|
| `kubeadm alpha` commands | alpha
|
||||||
|
| Implementation | alpha
|
||||||
|
|
||||||
|
The experience for the command line is currently in beta and we are trying hard
|
||||||
|
not to change command line flags and break that flow. Other parts of the
|
||||||
|
experience are still under active development. Specifically, kubeadm relies on
|
||||||
|
some features (bootstrap tokens, cluster signing), that are still considered
|
||||||
|
alpha. The implementation may change as the tool evolves to support easy
|
||||||
|
upgrades and high availability (HA). Any commands under `kubeadm alpha` (not
|
||||||
|
documented here) are, of course, alpha.
|
||||||
|
|
||||||
|
**Be sure to read the [limitations](#limitations)**. Specifically, configuring
|
||||||
|
cloud providers is difficult. Upgrades are also not well documented or
|
||||||
|
particularly easy.
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
@@ -65,8 +83,9 @@ complete clusters:
|
|||||||
|
|
||||||
You will install the following packages on all the machines:
|
You will install the following packages on all the machines:
|
||||||
|
|
||||||
* `docker`: the container runtime, which Kubernetes depends on. v1.11.2 is
|
* `docker`: the container runtime, which Kubernetes depends on. v1.12 is
|
||||||
recommended, but v1.10.3 and v1.12.1 are known to work as well.
|
recommended, but v1.10 and v1.11 are known to work as well. v1.13 and 17.03+
|
||||||
|
have not yet been tested and verified by the Kubernetes node team.
|
||||||
* `kubelet`: the most core component of Kubernetes. It runs on all of the
|
* `kubelet`: the most core component of Kubernetes. It runs on all of the
|
||||||
machines in your cluster and does things like starting pods and containers.
|
machines in your cluster and does things like starting pods and containers.
|
||||||
* `kubectl`: the command to control the cluster once it's running. You will only
|
* `kubectl`: the command to control the cluster once it's running. You will only
|
||||||
@@ -74,9 +93,9 @@ You will install the following packages on all the machines:
|
|||||||
well.
|
well.
|
||||||
* `kubeadm`: the command to bootstrap the cluster.
|
* `kubeadm`: the command to bootstrap the cluster.
|
||||||
|
|
||||||
NOTE: If you already have kubeadm installed, you should do a `apt-get update &&
|
**Note:** If you already have kubeadm installed, you should do a `apt-get update &&
|
||||||
apt-get upgrade` or `yum update` to get the latest version of kubeadm. See the
|
apt-get upgrade` or `yum update` to get the latest version of kubeadm. See the
|
||||||
reference doc if you want to read about the different [kubeadm
|
kubeadm release notes if you want to read about the different [kubeadm
|
||||||
releases](https://github.com/kubernetes/kubeadm/blob/master/CHANGELOG.md)
|
releases](https://github.com/kubernetes/kubeadm/blob/master/CHANGELOG.md)
|
||||||
|
|
||||||
For each host in turn:
|
For each host in turn:
|
||||||
@@ -88,7 +107,7 @@ For each host in turn:
|
|||||||
``` bash
|
``` bash
|
||||||
apt-get update && apt-get install -y apt-transport-https
|
apt-get update && apt-get install -y apt-transport-https
|
||||||
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
|
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
|
||||||
cat <<EOF > /etc/apt/sources.list.d/kubernetes.list
|
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
|
||||||
deb http://apt.kubernetes.io/ kubernetes-xenial main
|
deb http://apt.kubernetes.io/ kubernetes-xenial main
|
||||||
EOF
|
EOF
|
||||||
apt-get update
|
apt-get update
|
||||||
@@ -97,7 +116,7 @@ For each host in turn:
|
|||||||
apt-get install -y kubelet kubeadm kubectl kubernetes-cni
|
apt-get install -y kubelet kubeadm kubectl kubernetes-cni
|
||||||
```
|
```
|
||||||
|
|
||||||
If the machine is running CentOS, run:
|
* If the machine is running CentOS, run:
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
|
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
|
||||||
@@ -121,36 +140,16 @@ kubeadm to tell it what to do.
|
|||||||
|
|
||||||
Note: Disabling SELinux by running `setenforce 0` is required in order to allow
|
Note: Disabling SELinux by running `setenforce 0` is required in order to allow
|
||||||
containers to access the host filesystem, which is required by pod networks for
|
containers to access the host filesystem, which is required by pod networks for
|
||||||
example. You have to do this until kubelet can handle SELinux better.
|
example. You have to do this until SELinux support is improved in the kubelet.
|
||||||
|
|
||||||
### (2/4) Initializing your master
|
### (2/4) Initializing your master
|
||||||
|
|
||||||
The master is the machine where the "control plane" components run, including
|
The master is the machine where the "control plane" components run, including
|
||||||
etcd (the cluster database) and the API server (which the kubectl CLI
|
etcd (the cluster database) and the API server (which the kubectl CLI
|
||||||
communicates with). All of these components run in pods started by kubelet and
|
communicates with).
|
||||||
the following images are required and will be automatically pulled by kubelet
|
|
||||||
if they are absent while `kubeadm init` is initializing your master:
|
|
||||||
|
|
||||||
| Image Name | Version |
|
|
||||||
|---|---|
|
|
||||||
| gcr.io/google_containers/kube-proxy-amd64 | v1.5.3
|
|
||||||
| gcr.io/google_containers/kube-controller-manager-amd64 | v1.5.3
|
|
||||||
| gcr.io/google_containers/kube-scheduler-amd64 | v1.5.3
|
|
||||||
| gcr.io/google_containers/kube-apiserver-amd64 | v1.5.3
|
|
||||||
| gcr.io/google_containers/etcd-amd64 | 3.0.14-kubeadm
|
|
||||||
| gcr.io/google_containers/kube-discovery-amd64 | 1.0
|
|
||||||
| gcr.io/google_containers/pause-amd64 | 3.0
|
|
||||||
|
|
||||||
Right now you can't run `kubeadm init` twice without tearing down the cluster in
|
|
||||||
between, see [Tear down](#tear-down).
|
|
||||||
|
|
||||||
If you try to run `kubeadm init` and your machine is in a state that is
|
|
||||||
incompatible with starting a Kubernetes cluster, kubeadm will warn you about
|
|
||||||
things that might not work or it will error out for unsatisfied mandatory
|
|
||||||
requirements.
|
|
||||||
|
|
||||||
To initialize the master, pick one of the machines you previously installed
|
To initialize the master, pick one of the machines you previously installed
|
||||||
kubelet and kubeadm on, and run:
|
kubeadm on, and run:
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
kubeadm init
|
kubeadm init
|
||||||
@@ -158,67 +157,109 @@ kubeadm init
|
|||||||
|
|
||||||
**Note:** this will autodetect the network interface to advertise the master on
|
**Note:** this will autodetect the network interface to advertise the master on
|
||||||
as the interface with the default gateway. If you want to use a different
|
as the interface with the default gateway. If you want to use a different
|
||||||
interface, specify `--api-advertise-addresses <ip-address>` argument to `kubeadm
|
interface, specify `--apiserver-advertise-address <ip-address>` argument to `kubeadm
|
||||||
init`.
|
init`.
|
||||||
|
|
||||||
If you want to use [flannel](https://github.com/coreos/flannel) as the pod
|
There are pod network implementations where the master also plays a role in
|
||||||
network, specify `--pod-network-cidr 10.244.0.0/16` if you're using the
|
allocating a set of network address space for each node. When using
|
||||||
daemonset manifest below. _However, please note that this is not required for
|
[flannel](https://github.com/coreos/flannel) as the [pod network](#pod-network)
|
||||||
any other networks besides Flannel._
|
(described in step 3), specify `--pod-network-cidr 10.244.0.0/16`. _This is not
|
||||||
|
required for any other networks besides Flannel._
|
||||||
|
|
||||||
Please refer to the [kubeadm reference doc](/docs/admin/kubeadm/) if you want to
|
Please refer to the [kubeadm reference doc](/docs/admin/kubeadm/) if you want to
|
||||||
read more about the flags `kubeadm init` provides.
|
read more about the flags `kubeadm init` provides.
|
||||||
|
|
||||||
This will download and install the cluster database and "control plane"
|
`kubeadm init` will first run a series of prechecks to ensure that the machine
|
||||||
|
is ready to run Kubernetes. It will expose warnings and exit on errors. It
|
||||||
|
will then download and install the cluster database and "control plane"
|
||||||
components. This may take several minutes.
|
components. This may take several minutes.
|
||||||
|
|
||||||
|
You can't run `kubeadm init` twice without tearing down the cluster in between,
|
||||||
|
see [Tear Down](#tear-down).
|
||||||
|
|
||||||
The output should look like:
|
The output should look like:
|
||||||
|
|
||||||
```
|
```
|
||||||
[kubeadm] WARNING: kubeadm is in alpha, please do not use it for production clusters.
|
[kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters.
|
||||||
|
[init] Using Kubernetes version: v1.6.0
|
||||||
|
[init] Using Authorization mode: RBAC
|
||||||
[preflight] Running pre-flight checks
|
[preflight] Running pre-flight checks
|
||||||
[init] Using Kubernetes version: v1.5.1
|
[preflight] Starting the kubelet service
|
||||||
[tokens] Generated token: "064158.548b9ddb1d3fad3e"
|
[certificates] Generated CA certificate and key.
|
||||||
[certificates] Generated Certificate Authority key and certificate.
|
[certificates] Generated API server certificate and key.
|
||||||
[certificates] Generated API Server key and certificate
|
[certificates] API Server serving cert is signed for DNS names [kubeadm-master kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 10.138.0.4]
|
||||||
[certificates] Generated Service Account signing keys
|
[certificates] Generated API server kubelet client certificate and key.
|
||||||
[certificates] Created keys and certificates in "/etc/kubernetes/pki"
|
[certificates] Generated service account token signing key and public key.
|
||||||
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/kubelet.conf"
|
[certificates] Generated front-proxy CA certificate and key.
|
||||||
|
[certificates] Generated front-proxy client certificate and key.
|
||||||
|
[certificates] Valid certificates and keys now exist in "/etc/kubernetes/pki"
|
||||||
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/admin.conf"
|
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/admin.conf"
|
||||||
|
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/kubelet.conf"
|
||||||
|
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/controller-manager.conf"
|
||||||
|
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/scheduler.conf"
|
||||||
[apiclient] Created API client, waiting for the control plane to become ready
|
[apiclient] Created API client, waiting for the control plane to become ready
|
||||||
[apiclient] All control plane components are healthy after 61.317580 seconds
|
[apiclient] All control plane components are healthy after 16.772251 seconds
|
||||||
[apiclient] Waiting for at least one node to register and become ready
|
[apiclient] Waiting for at least one node to register and become ready
|
||||||
[apiclient] First node is ready after 6.556101 seconds
|
[apiclient] First node is ready after 5.002536 seconds
|
||||||
[apiclient] Creating a test deployment
|
|
||||||
[apiclient] Test deployment succeeded
|
[apiclient] Test deployment succeeded
|
||||||
[token-discovery] Created the kube-discovery deployment, waiting for it to become ready
|
[token] Using token: <token>
|
||||||
[token-discovery] kube-discovery is ready after 6.020980 seconds
|
[apiconfig] Created RBAC rules
|
||||||
[addons] Created essential addon: kube-proxy
|
[addons] Created essential addon: kube-proxy
|
||||||
[addons] Created essential addon: kube-dns
|
[addons] Created essential addon: kube-dns
|
||||||
|
|
||||||
Your Kubernetes master has initialized successfully!
|
Your Kubernetes master has initialized successfully!
|
||||||
|
|
||||||
|
To start using your cluster, you need to run (as a regular user):
|
||||||
|
|
||||||
|
sudo cp /etc/kubernetes/admin.conf $HOME/
|
||||||
|
sudo chown $(id -u):$(id -g) $HOME/admin.conf
|
||||||
|
export KUBECONFIG=$HOME/admin.conf
|
||||||
|
|
||||||
You should now deploy a pod network to the cluster.
|
You should now deploy a pod network to the cluster.
|
||||||
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
|
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
|
||||||
http://kubernetes.io/docs/admin/addons/
|
http://kubernetes.io/docs/admin/addons/
|
||||||
|
|
||||||
You can now join any number of machines by running the following on each node:
|
You can now join any number of machines by running the following on each node
|
||||||
|
as root:
|
||||||
|
|
||||||
kubeadm join --token=<token> <master-ip>
|
kubeadm join --token <token> <master-ip>:<master-port>
|
||||||
```
|
```
|
||||||
|
|
||||||
Make a record of the `kubeadm join` command that `kubeadm init` outputs. You
|
Make a record of the `kubeadm join` command that `kubeadm init` outputs. You
|
||||||
will need this in a moment. The key included here is secret, keep it safe
|
will need this in a moment.
|
||||||
— anyone with this key can add authenticated nodes to your cluster.
|
|
||||||
|
|
||||||
The key is used for mutual authentication between the master and the joining nodes.
|
The token is used for mutual authentication between the master and the joining
|
||||||
|
nodes. The token included here is secret, keep it safe — anyone with this
|
||||||
|
token can add authenticated nodes to your cluster. These tokens can be listed,
|
||||||
|
created and deleted with the `kubeadm token` command. See the [reference
|
||||||
|
guide](/docs/admin/kubeadm/#manage-tokens).
|
||||||
|
|
||||||
|
#### Master Images
|
||||||
|
|
||||||
|
All of these components run in pods started by kubelet and the following images
|
||||||
|
are required and will be automatically pulled by kubelet if they are absent
|
||||||
|
while `kubeadm init` is initializing your master:
|
||||||
|
|
||||||
|
| Image Name | Version |
|
||||||
|
|---|---|
|
||||||
|
| gcr.io/google_containers/kube-apiserver-amd64 | v1.6.0
|
||||||
|
| gcr.io/google_containers/kube-controller-manager-amd64 | v1.6.0
|
||||||
|
| gcr.io/google_containers/kube-scheduler-amd64 | v1.6.0
|
||||||
|
| gcr.io/google_containers/kube-proxy-amd64 | v1.6.0
|
||||||
|
| gcr.io/google_containers/etcd-amd64 | 3.0.17
|
||||||
|
| gcr.io/google_containers/pause-amd64 | 3.0
|
||||||
|
| gcr.io/google_containers/k8s-dns-sidecar-amd64 | 1.14.1
|
||||||
|
| gcr.io/google_containers/k8s-dns-kube-dns-amd64 | 1.14.1
|
||||||
|
| gcr.io/google_containers/k8s-dns-dnsmasq-nanny-amd64 | 1.14.1
|
||||||
|
|
||||||
|
#### Master Isolation
|
||||||
|
|
||||||
By default, your cluster will not schedule pods on the master for security
|
By default, your cluster will not schedule pods on the master for security
|
||||||
reasons. If you want to be able to schedule pods on the master, for example if
|
reasons. If you want to be able to schedule pods on the master, e.g a
|
||||||
you want a single-machine Kubernetes cluster for development, run:
|
single-machine Kubernetes cluster for development, run:
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
kubectl taint nodes --all dedicated-
|
kubectl taint nodes --all node-role.kubernetes.io/master-
|
||||||
```
|
```
|
||||||
|
|
||||||
With output looking something like:
|
With output looking something like:
|
||||||
@@ -229,24 +270,28 @@ taint key="dedicated" and effect="" not found.
|
|||||||
taint key="dedicated" and effect="" not found.
|
taint key="dedicated" and effect="" not found.
|
||||||
```
|
```
|
||||||
|
|
||||||
This will remove the "dedicated" taint from any nodes that have it, including
|
This will remove the `node-role.kubernetes.io/master` taint from any nodes that
|
||||||
the master node, meaning that the scheduler will then be able to schedule pods
|
have it, including the master node, meaning that the scheduler will then be able
|
||||||
everywhere.
|
to schedule pods everywhere.
|
||||||
|
|
||||||
### (3/4) Installing a pod network
|
### (3/4) Installing a pod network {#pod-network}
|
||||||
|
|
||||||
You must install a pod network add-on so that your pods can communicate with
|
You must install a pod network add-on so that your pods can communicate with
|
||||||
each other.
|
each other.
|
||||||
|
|
||||||
**It is necessary to do this before you try to deploy any applications to your
|
**The network must be deployed before any applications. Also, kube-dns, a
|
||||||
cluster. Also, kube-dns, a helper service, will no start up before a network is
|
helper service, will not start up before a network is installed. kubeadm only
|
||||||
installed. Note also that kubeadm only supports CNI based networks and therefore
|
supports CNI based networks (and does not support kubenet).**
|
||||||
kubenet based networks will not work.**
|
|
||||||
|
|
||||||
Several projects provide Kubernetes pod networks using CNI, some of which also
|
Several projects provide Kubernetes pod networks using CNI, some of which also
|
||||||
support [Network Policy](/docs/user-guide/networkpolicies/). See the [add-ons
|
support [Network Policy](/docs/user-guide/networkpolicies/). See the [add-ons
|
||||||
page](/docs/admin/addons/) for a complete list of available network add-ons.
|
page](/docs/admin/addons/) for a complete list of available network add-ons.
|
||||||
|
|
||||||
|
**New for Kubernetes 1.6:** kubeadm 1.6 sets up a more secure cluster by
|
||||||
|
default. As such it uses RBAC to grant limited privileges to workloads running
|
||||||
|
on the cluster. This includes networking integrations. As such, ensure that
|
||||||
|
you are using a network system that has been updated to run with 1.6 and RBAC.
|
||||||
|
|
||||||
You can install a pod network add-on with the following command:
|
You can install a pod network add-on with the following command:
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
@@ -258,127 +303,76 @@ should only install one pod network per cluster.
|
|||||||
|
|
||||||
If you are on another architecture than amd64, you should use the flannel
|
If you are on another architecture than amd64, you should use the flannel
|
||||||
overlay network as described in [the multi-platform
|
overlay network as described in [the multi-platform
|
||||||
section](#kubeadm-is-multi-platform)
|
section](#multi-platform)
|
||||||
|
|
||||||
NOTE: You can install **only one** pod network per cluster.
|
NOTE: You can install **only one** pod network per cluster.
|
||||||
|
|
||||||
Once a pod network has been installed, you can confirm that it is working by
|
Once a pod network has been installed, you can confirm that it is working by
|
||||||
checking that the kube-dns pod is `Running` in the output of `kubectl get pods
|
checking that the kube-dns pod is Running in the output of `kubectl get pods
|
||||||
--all-namespaces`.
|
--all-namespaces`. And once the kube-dns pod is up and running, you can continue by joining your
|
||||||
|
|
||||||
And once the kube-dns pod is up and running, you can continue by joining your
|
|
||||||
nodes.
|
nodes.
|
||||||
|
|
||||||
You may have trouble in the configuration if you see the following statuses
|
If your network is not working or kube-dns is not in the Running state, check
|
||||||
|
out the [troubleshooting secion](#pod-network-trouble) below.
|
||||||
```
|
|
||||||
NAMESPACE NAME READY STATUS RESTARTS AGE
|
|
||||||
kube-system canal-node-f0lqp 2/3 RunContainerError 2 48s
|
|
||||||
kube-system canal-node-77d0h 2/3 CrashLoopBackOff 3 3m
|
|
||||||
kube-system kube-dns-2924299975-7q1vq 0/4 ContainerCreating 0 15m
|
|
||||||
```
|
|
||||||
|
|
||||||
The three statuses ```RunContainerError``` and ```CrashLoopBackOff``` and
|
|
||||||
```ContainerCreating``` are very common.
|
|
||||||
|
|
||||||
To help diagnose what happened, you can use the following command to check what
|
|
||||||
is in the logs:
|
|
||||||
|
|
||||||
``` bash
|
|
||||||
kubectl describe -n kube-system po {YOUR_POD_NAME}
|
|
||||||
```
|
|
||||||
|
|
||||||
Do not using kubectl logs. If you run:
|
|
||||||
|
|
||||||
``` bash
|
|
||||||
kubectl logs -n kube-system canal-node-f0lqp
|
|
||||||
```
|
|
||||||
|
|
||||||
You will got the following error:
|
|
||||||
|
|
||||||
```
|
|
||||||
Error from server (BadRequest): the server rejected our request for an unknown reason (get pods canal-node-f0lqp)
|
|
||||||
```
|
|
||||||
|
|
||||||
The ```kubectl describe``` comand gives you more details about what went wrong.
|
|
||||||
|
|
||||||
``` bash
|
|
||||||
kubectl describe -n kube-system po kube-dns-2924299975-1l2t7
|
|
||||||
```
|
|
||||||
|
|
||||||
The events should show something like this:
|
|
||||||
|
|
||||||
```
|
|
||||||
2m 2m 1 {kubelet nac} spec.containers{flannel} Warning Failed Failed to start container with docker id 927e7ccdc32b with error: Error response from daemon: {"message":"chown /etc/resolv.conf: operation not permitted"}
|
|
||||||
```
|
|
||||||
|
|
||||||
Or this:
|
|
||||||
|
|
||||||
```
|
|
||||||
6m 1m 191 {kubelet nac} Warning FailedSync Error syncing pod, skipping: failed to "SetupNetwork" for "kube-dns-2924299975-1l2t7_kube-system" with SetupNetworkError: "Failed to setup network for pod \"kube-dns-2924299975-1l2t7_kube-system(dee8ef21-fbcb-11e6-ba19-38d547e0006a)\" using network plugins \"cni\": open /run/flannel/subnet.env: no such file or directory; Skipping pod"
|
|
||||||
```
|
|
||||||
|
|
||||||
You can then do some Google searches on the error messages, which may help you
|
|
||||||
to find some solutions.
|
|
||||||
|
|
||||||
### (4/4) Joining your nodes
|
### (4/4) Joining your nodes
|
||||||
|
|
||||||
The nodes are where your workloads (containers and pods, etc) run. If you want
|
The nodes are where your workloads (containers and pods, etc) run. To add new nodes to your cluster do the following for each machine:
|
||||||
to add any new machines as nodes to your cluster, for each machine: SSH to that
|
|
||||||
machine, become root (e.g. `sudo su -`) and run the command that was output by
|
|
||||||
`kubeadm init`. For example:
|
|
||||||
|
|
||||||
``` bash
|
* SSH to the machine
|
||||||
kubeadm join --token <token> <master-ip>
|
* Become root (e.g. `sudo su -`)
|
||||||
```
|
* Run the command that was output by `kubeadm init`. For example:
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
kubeadm join --token <token> <master-ip>:<master-port>
|
||||||
|
```
|
||||||
|
|
||||||
The output should look something like:
|
The output should look something like:
|
||||||
|
|
||||||
```
|
```
|
||||||
[kubeadm] WARNING: kubeadm is in alpha, please do not use it for production clusters.
|
[kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters.
|
||||||
[preflight] Running pre-flight checks
|
[preflight] Running pre-flight checks
|
||||||
[preflight] Starting the kubelet service
|
[discovery] Trying to connect to API Server "10.138.0.4:6443"
|
||||||
[tokens] Validating provided token
|
[discovery] Created cluster-info discovery client, requesting info from "https://10.138.0.4:6443"
|
||||||
[discovery] Created cluster info discovery client, requesting info from "http://192.168.x.y:9898/cluster-info/v1/?token-id=f11877"
|
[discovery] Cluster info signature and contents are valid, will use API Server "https://10.138.0.4:6443"
|
||||||
[discovery] Cluster info object received, verifying signature using given token
|
[discovery] Successfully established connection with API Server "10.138.0.4:6443"
|
||||||
[discovery] Cluster info signature and contents are valid, will use API endpoints [https://192.168.x.y:6443]
|
[bootstrap] Detected server version: v1.6.0-beta.3
|
||||||
[bootstrap] Trying to connect to endpoint https://192.168.x.y:6443
|
[bootstrap] The server supports the Certificates API (certificates.k8s.io/v1beta1)
|
||||||
[bootstrap] Detected server version: v1.5.1
|
|
||||||
[bootstrap] Successfully established connection with endpoint "https://192.168.x.y:6443"
|
|
||||||
[csr] Created API client to obtain unique certificate for this node, generating keys and certificate signing request
|
[csr] Created API client to obtain unique certificate for this node, generating keys and certificate signing request
|
||||||
[csr] Received signed certificate from the API server:
|
[csr] Received signed certificate from the API server, generating KubeConfig...
|
||||||
Issuer: CN=kubernetes | Subject: CN=system:node:yournode | CA: false
|
|
||||||
Not before: 2016-12-15 19:44:00 +0000 UTC Not After: 2017-12-15 19:44:00 +0000 UTC
|
|
||||||
[csr] Generating kubelet configuration
|
|
||||||
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/kubelet.conf"
|
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/kubelet.conf"
|
||||||
|
|
||||||
Node join complete:
|
Node join complete:
|
||||||
* Certificate signing request sent to master and response
|
* Certificate signing request sent to master and response
|
||||||
received.
|
received.
|
||||||
* Kubelet informed of new secure connection details.
|
* Kubelet informed of new secure connection details.
|
||||||
|
|
||||||
Run 'kubectl get nodes' on the master to see this machine join.
|
Run 'kubectl get nodes' on the master to see this machine join.
|
||||||
```
|
```
|
||||||
|
|
||||||
A few seconds later, you should notice that running `kubectl get nodes` on the
|
A few seconds later, you should notice this node in the output from `kubectl get
|
||||||
master shows a cluster with as many machines as you created.
|
nodes` when run on the master.
|
||||||
|
|
||||||
### (Optional) Controlling your cluster from machines other than the master
|
### (Optional) Controlling your cluster from machines other than the master
|
||||||
|
|
||||||
In order to get a kubectl on your laptop for example to talk to your cluster,
|
In order to get a kubectl on some other computer (e.g. laptop) to talk to your
|
||||||
you need to copy the `KubeConfig` file from your master to your laptop like
|
cluster, you need to copy the kubeconfig file from your master to your
|
||||||
this:
|
workstation like this:
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
scp root@<master ip>:/etc/kubernetes/admin.conf .
|
scp root@<master ip>:/etc/kubernetes/admin.conf .
|
||||||
kubectl --kubeconfig ./admin.conf get nodes
|
kubectl --kubeconfig ./admin.conf get nodes
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Note:** If you are using GCE, instances, by default, disable ssh access for
|
||||||
|
root. First log in to the machine, copy the file someplace that can be accessed
|
||||||
|
and then use [`gcloud compute
|
||||||
|
copy-files`](https://cloud.google.com/sdk/gcloud/reference/compute/copy-files)
|
||||||
|
|
||||||
### (Optional) Connecting to the API Server
|
### (Optional) Connecting to the API Server
|
||||||
|
|
||||||
If you want to connect to the API Server for viewing the dashboard (note: the
|
If you want to connect to the API Server from outside the cluster you can use
|
||||||
dashboard isn't deployed by default) from outside the cluster for example, you
|
`kubectl proxy`:
|
||||||
can use `kubectl proxy`:
|
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
scp root@<master ip>:/etc/kubernetes/admin.conf .
|
scp root@<master ip>:/etc/kubernetes/admin.conf .
|
||||||
@@ -389,11 +383,13 @@ You can now access the API Server locally at `http://localhost:8001/api/v1`
|
|||||||
|
|
||||||
### (Optional) Installing a sample application
|
### (Optional) Installing a sample application
|
||||||
|
|
||||||
As an example, install a sample microservices application, a socks shop, to put
|
Now it is time to take your new cluster for a test drive. Sock Shop is a sample
|
||||||
your cluster through its paces. Note that this demo does only work on `amd64`.
|
microservices application that shows how to run and connect a set of services on
|
||||||
To learn more about the sample microservices app, see the [GitHub
|
Kubernetes. To learn more about the sample microservices app, see the [GitHub
|
||||||
README](https://github.com/microservices-demo/microservices-demo).
|
README](https://github.com/microservices-demo/microservices-demo).
|
||||||
|
|
||||||
|
Note that the Sock Shop demo only works on `amd64`.
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
kubectl create namespace sock-shop
|
kubectl create namespace sock-shop
|
||||||
kubectl apply -n sock-shop -f "https://github.com/microservices-demo/microservices-demo/blob/master/deploy/kubernetes/complete-demo.yaml?raw=true"
|
kubectl apply -n sock-shop -f "https://github.com/microservices-demo/microservices-demo/blob/master/deploy/kubernetes/complete-demo.yaml?raw=true"
|
||||||
@@ -404,22 +400,14 @@ services](/docs/user-guide/services/) allocated for the front-end service by
|
|||||||
running:
|
running:
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
kubectl describe svc front-end -n sock-shop
|
kubectl -n sock-shop get svc front-end
|
||||||
```
|
```
|
||||||
|
|
||||||
Output:
|
Output:
|
||||||
|
|
||||||
```
|
```
|
||||||
Name: front-end
|
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
|
||||||
Namespace: sock-shop
|
front-end 10.110.250.153 <nodes> 80:30001/TCP 59s
|
||||||
Labels: name=front-end
|
|
||||||
Selector: name=front-end
|
|
||||||
Type: NodePort
|
|
||||||
IP: 100.66.88.176
|
|
||||||
Port: <unset> 80/TCP
|
|
||||||
NodePort: <unset> 31869/TCP
|
|
||||||
Endpoints: <none>
|
|
||||||
Session Affinity: None
|
|
||||||
```
|
```
|
||||||
|
|
||||||
It takes several minutes to download and start all the containers, watch the
|
It takes several minutes to download and start all the containers, watch the
|
||||||
@@ -428,23 +416,35 @@ running.
|
|||||||
|
|
||||||
Then go to the IP address of your cluster's master node in your browser, and
|
Then go to the IP address of your cluster's master node in your browser, and
|
||||||
specify the given port. So for example, `http://<master_ip>:<port>`. In the
|
specify the given port. So for example, `http://<master_ip>:<port>`. In the
|
||||||
example above, this was `30001`, but it is a different port for you.
|
example above, this was `30001`, but it may be a different port for you.
|
||||||
|
|
||||||
If there is a firewall, make sure it exposes this port to the internet before
|
If there is a firewall, make sure it exposes this port to the internet before
|
||||||
you try to access it.
|
you try to access it.
|
||||||
|
|
||||||
|
To uninstall the socks shop, run `kubectl delete namespace sock-shop` on the
|
||||||
|
master.
|
||||||
|
|
||||||
## Tear down
|
## Tear down
|
||||||
|
|
||||||
* To uninstall the socks shop, run `kubectl delete namespace sock-shop` on the
|
To undo what kubeadm did, you should first [drain the
|
||||||
master.
|
node](https://kubernetes.io/docs/user-guide/kubectl/kubectl_drain/) and make
|
||||||
* To undo what kubeadm did, simply run:
|
sure that the node is empty before shutting it down.
|
||||||
|
|
||||||
``` bash
|
Talking to the master with the appropriate credentials, run:
|
||||||
kubeadm reset
|
|
||||||
```
|
|
||||||
|
|
||||||
If you wish to start over, run `systemctl start kubelet` followed by `kubeadm
|
``` bash
|
||||||
init` or `kubeadm join`.
|
kubectl drain <node name> --delete-local-data --force --ignore-daemonsets
|
||||||
|
kubectl delete node <node name>
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, on the node being removed, reset all kubeadm installed state:
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
kubeadm reset
|
||||||
|
```
|
||||||
|
|
||||||
|
If you wish to start over simply run `kubeadm init` or `kubeadm join` with the
|
||||||
|
appropriate arguments.
|
||||||
|
|
||||||
## Explore other add-ons
|
## Explore other add-ons
|
||||||
|
|
||||||
@@ -468,7 +468,7 @@ control of your Kubernetes cluster.
|
|||||||
* [GitHub Issues in the kubeadm
|
* [GitHub Issues in the kubeadm
|
||||||
repository](https://github.com/kubernetes/kubeadm/issues)
|
repository](https://github.com/kubernetes/kubeadm/issues)
|
||||||
|
|
||||||
## kubeadm is multi-platform
|
## kubeadm is multi-platform {#multi-platform}
|
||||||
|
|
||||||
kubeadm deb packages and binaries are built for amd64, arm and arm64, following
|
kubeadm deb packages and binaries are built for amd64, arm and arm64, following
|
||||||
the [multi-platform
|
the [multi-platform
|
||||||
@@ -491,9 +491,9 @@ RPi 3 you should set `ARCH` to `arm`, not `arm64`.
|
|||||||
|
|
||||||
## Cloudprovider integrations (experimental)
|
## Cloudprovider integrations (experimental)
|
||||||
|
|
||||||
Enabling specific cloud providers is a common request, this currently requires
|
Enabling specific cloud providers is a common request. This currently requires
|
||||||
manual configuration and is therefore not yet supported. If you wish to do so,
|
manual configuration and is therefore not yet fully supported. If you wish to do
|
||||||
edit the kubeadm dropin for the kubelet service
|
so, edit the kubeadm dropin for the kubelet service
|
||||||
(`/etc/systemd/system/kubelet.service.d/10-kubeadm.conf`) on all nodes,
|
(`/etc/systemd/system/kubelet.service.d/10-kubeadm.conf`) on all nodes,
|
||||||
including the master. If your cloud provider requires any extra packages
|
including the master. If your cloud provider requires any extra packages
|
||||||
installed on host, for example for volume mounting/unmounting, install those
|
installed on host, for example for volume mounting/unmounting, install those
|
||||||
@@ -506,8 +506,17 @@ that file depends on the requirements imposed by your cloud provider. If you use
|
|||||||
the `/etc/kubernetes/cloud-config` file, you must append it to the kubelet
|
the `/etc/kubernetes/cloud-config` file, you must append it to the kubelet
|
||||||
arguments as follows: `--cloud-config=/etc/kubernetes/cloud-config`
|
arguments as follows: `--cloud-config=/etc/kubernetes/cloud-config`
|
||||||
|
|
||||||
Lastly, run `kubeadm init --cloud-provider=xxx` to bootstrap your cluster with
|
Next, specify the cloud provider in the kubeadm config file. Create a file called
|
||||||
cloud provider features.
|
`kubeadm.conf` with the following contents:
|
||||||
|
|
||||||
|
``` yaml
|
||||||
|
kind: MasterConfiguration
|
||||||
|
apiVersion: kubeadm.k8s.io/v1alpha1
|
||||||
|
cloudProvider: <cloud provider>
|
||||||
|
```
|
||||||
|
|
||||||
|
Lastly, run `kubeadm init --config=kubeadm.conf` to bootstrap your cluster with
|
||||||
|
the cloud provider.
|
||||||
|
|
||||||
This workflow is not yet fully supported, however we hope to make it extremely
|
This workflow is not yet fully supported, however we hope to make it extremely
|
||||||
easy to spin up clusters with cloud providers in the future. (See [this
|
easy to spin up clusters with cloud providers in the future. (See [this
|
||||||
@@ -530,6 +539,7 @@ addressed in due course.
|
|||||||
Workaround: regularly [back up
|
Workaround: regularly [back up
|
||||||
etcd](https://coreos.com/etcd/docs/latest/admin_guide.html). The etcd data
|
etcd](https://coreos.com/etcd/docs/latest/admin_guide.html). The etcd data
|
||||||
directory configured by kubeadm is at `/var/lib/etcd` on the master.
|
directory configured by kubeadm is at `/var/lib/etcd` on the master.
|
||||||
|
|
||||||
1. The `HostPort` and `HostIP` functionality does not work with kubeadm due to
|
1. The `HostPort` and `HostIP` functionality does not work with kubeadm due to
|
||||||
that CNI networking is used, see issue
|
that CNI networking is used, see issue
|
||||||
[#31307](https://github.com/kubernetes/kubernetes/issues/31307).
|
[#31307](https://github.com/kubernetes/kubernetes/issues/31307).
|
||||||
@@ -537,6 +547,7 @@ addressed in due course.
|
|||||||
Workaround: use the [NodePort feature of
|
Workaround: use the [NodePort feature of
|
||||||
services](/docs/user-guide/services/#type-nodeport) instead, or use
|
services](/docs/user-guide/services/#type-nodeport) instead, or use
|
||||||
HostNetwork.
|
HostNetwork.
|
||||||
|
|
||||||
1. Some users on RHEL/CentOS 7 have reported issues with traffic being routed
|
1. Some users on RHEL/CentOS 7 have reported issues with traffic being routed
|
||||||
incorrectly due to iptables being bypassed. You should ensure
|
incorrectly due to iptables being bypassed. You should ensure
|
||||||
`net.bridge.bridge-nf-call-iptables` is set to 1 in your sysctl config, eg.
|
`net.bridge.bridge-nf-call-iptables` is set to 1 in your sysctl config, eg.
|
||||||
@@ -552,18 +563,8 @@ addressed in due course.
|
|||||||
net.bridge.bridge-nf-call-iptables = 1
|
net.bridge.bridge-nf-call-iptables = 1
|
||||||
```
|
```
|
||||||
|
|
||||||
1. There is no built-in way of fetching the token easily once the cluster is up
|
1. Users can list, create and delete tokens using the `kubeadm token` command.
|
||||||
and running, but here is a kubectl command you can copy and paste that will
|
See the [reference guide](/docs/admin/kubeadm/#manage-tokens) for details.
|
||||||
print out the token for you:
|
|
||||||
|
|
||||||
``` bash
|
|
||||||
kubectl -n kube-system get secret clusterinfo -o yaml | \
|
|
||||||
grep token-map | \
|
|
||||||
awk '{print $2}' | \
|
|
||||||
base64 --decode | \
|
|
||||||
sed "s|{||g;s|}||g;s|:|.|g;s/\"//g;" | \
|
|
||||||
xargs echo
|
|
||||||
```
|
|
||||||
|
|
||||||
1. If you are using VirtualBox (directly or via Vagrant), you will need to
|
1. If you are using VirtualBox (directly or via Vagrant), you will need to
|
||||||
ensure that `hostname -i` returns a routable IP address (i.e. one on the
|
ensure that `hostname -i` returns a routable IP address (i.e. one on the
|
||||||
@@ -573,3 +574,63 @@ addressed in due course.
|
|||||||
[`Vagrantfile`][ubuntu-vagrantfile] for how this can be achieved.
|
[`Vagrantfile`][ubuntu-vagrantfile] for how this can be achieved.
|
||||||
|
|
||||||
[ubuntu-vagrantfile]: https://github.com/errordeveloper/k8s-playground/blob/22dd39dfc06111235620e6c4404a96ae146f26fd/Vagrantfile#L11),
|
[ubuntu-vagrantfile]: https://github.com/errordeveloper/k8s-playground/blob/22dd39dfc06111235620e6c4404a96ae146f26fd/Vagrantfile#L11),
|
||||||
|
|
||||||
|
## Troubleshooting {#troubleshooting}
|
||||||
|
|
||||||
|
### Pod Network Troubleshooting {#pod-network-trouble}
|
||||||
|
|
||||||
|
You may have trouble in the configuration if you see the following statuses.
|
||||||
|
This example is for canal but there may be similar errors for other pod network
|
||||||
|
systems.
|
||||||
|
|
||||||
|
```
|
||||||
|
NAMESPACE NAME READY STATUS RESTARTS AGE
|
||||||
|
kube-system canal-node-f0lqp 2/3 RunContainerError 2 48s
|
||||||
|
kube-system canal-node-77d0h 2/3 CrashLoopBackOff 3 3m
|
||||||
|
kube-system kube-dns-2924299975-7q1vq 0/4 ContainerCreating 0 15m
|
||||||
|
```
|
||||||
|
|
||||||
|
The three statuses RunContainerError and CrashLoopBackOff and ContainerCreating
|
||||||
|
are very common.
|
||||||
|
|
||||||
|
To help diagnose what happened, you can use the following command to check what
|
||||||
|
is in the logs:
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
kubectl describe -n kube-system po {YOUR_POD_NAME}
|
||||||
|
```
|
||||||
|
|
||||||
|
Do not use kubectl logs as they only work with Pods that have started. If you run:
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
kubectl logs -n kube-system canal-node-f0lqp
|
||||||
|
```
|
||||||
|
|
||||||
|
You will got the following error:
|
||||||
|
|
||||||
|
```
|
||||||
|
Error from server (BadRequest): the server rejected our request for an unknown reason (get pods canal-node-f0lqp)
|
||||||
|
```
|
||||||
|
|
||||||
|
The `kubectl describe` comand gives you more details about what went wrong.
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
kubectl describe -n kube-system po kube-dns-2924299975-1l2t7
|
||||||
|
```
|
||||||
|
|
||||||
|
The events should show something like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
2m 2m 1 {kubelet nac} spec.containers{flannel} Warning Failed Failed to start container with docker id 927e7ccdc32b with error: Error response from daemon: {"message":"chown /etc/resolv.conf: operation not permitted"}
|
||||||
|
```
|
||||||
|
|
||||||
|
Or this:
|
||||||
|
|
||||||
|
```
|
||||||
|
6m 1m 191 {kubelet nac} Warning FailedSync Error syncing pod, skipping: failed to "SetupNetwork" for "kube-dns-2924299975-1l2t7_kube-system" with SetupNetworkError: "Failed to setup network for pod \"kube-dns-2924299975-1l2t7_kube-system(dee8ef21-fbcb-11e6-ba19-38d547e0006a)\" using network plugins \"cni\": open /run/flannel/subnet.env: no such file or directory; Skipping pod"
|
||||||
|
```
|
||||||
|
|
||||||
|
A web search on the error message may help narrow down the issue. Or
|
||||||
|
communicate the errors you are seeing to the community/company that provides the
|
||||||
|
pod network implementation you are using.
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ title: Kubernetes Documentation
|
|||||||
<ul>
|
<ul>
|
||||||
<li><a href="/docs/getting-started-guides/minikube/">Minikube</a>: Install a single-node Kubernetes cluster on your local machine for development and testing.</li>
|
<li><a href="/docs/getting-started-guides/minikube/">Minikube</a>: Install a single-node Kubernetes cluster on your local machine for development and testing.</li>
|
||||||
<li><a href="/docs/getting-started-guides/kops/">Installing Kubernetes on AWS with kops</a>: Bring up a complete Kubernetes cluster on Amazon Web Services, using a tool called <code>kops</code>.</li>
|
<li><a href="/docs/getting-started-guides/kops/">Installing Kubernetes on AWS with kops</a>: Bring up a complete Kubernetes cluster on Amazon Web Services, using a tool called <code>kops</code>.</li>
|
||||||
<li><a href="/docs/getting-started-guides/kubeadm/">Installing Kubernetes on Linux with kubeadm</a> (Alpha): Install a secure Kubernetes cluster on any pre-existing machines running Linux, using the built-in <code>kubeadm</code> tool.</li>
|
<li><a href="/docs/getting-started-guides/kubeadm/">Installing Kubernetes on Linux with kubeadm</a> (Beta): Install a secure Kubernetes cluster on any pre-existing machines running Linux, using the built-in <code>kubeadm</code> tool.</li>
|
||||||
<li><a href="/docs/getting-started-guides/kargo/">Installing Kubernetes On-premise/Cloud Providers with Kargo</a>: Deploy a Kubernetes cluster on-premise baremetal or hosted on cloud providers, with Ansible and <code>kargo</code> tools.</li>
|
<li><a href="/docs/getting-started-guides/kargo/">Installing Kubernetes On-premise/Cloud Providers with Kargo</a>: Deploy a Kubernetes cluster on-premise baremetal or hosted on cloud providers, with Ansible and <code>kargo</code> tools.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -10,23 +10,23 @@ Kubernetes contains several built-in tools to help you work with the Kubernetes
|
|||||||
|
|
||||||
Kubernetes contains the following built-in tools:
|
Kubernetes contains the following built-in tools:
|
||||||
|
|
||||||
##### Kubectl
|
##### Kubectl
|
||||||
|
|
||||||
[`kubectl`](/docs/user-guide/kubectl/) is the command line tool for Kubernetes. It controls the Kubernetes cluster manager.
|
[`kubectl`](/docs/user-guide/kubectl/) is the command line tool for Kubernetes. It controls the Kubernetes cluster manager.
|
||||||
|
|
||||||
##### Kubeadm
|
##### Kubeadm
|
||||||
|
|
||||||
[`kubeadm`](/docs/getting-started-guides/kubeadm/) is the command line tool for easily provisioning a secure Kubernetes cluster on top of physical or cloud servers or virtual machines (currently in alpha).
|
[`kubeadm`](/docs/getting-started-guides/kubeadm/) is the command line tool for easily provisioning a secure Kubernetes cluster on top of physical or cloud servers or virtual machines (currently in beta).
|
||||||
|
|
||||||
##### Kubefed
|
##### Kubefed
|
||||||
|
|
||||||
[`kubefed`](/docs/admin/federation/kubefed/) is the command line tool
|
[`kubefed`](/docs/admin/federation/kubefed/) is the command line tool
|
||||||
to help you administrate your federated clusters.
|
to help you administrate your federated clusters.
|
||||||
|
|
||||||
##### Dashboard
|
##### Dashboard
|
||||||
|
|
||||||
[Dashboard](/docs/user-guide/ui/), the web-based user interface of Kubernetes, allows you to deploy containerized applications
|
[Dashboard](/docs/user-guide/ui/), the web-based user interface of Kubernetes, allows you to deploy containerized applications
|
||||||
to a Kubernetes cluster, troubleshoot them, and manage the cluster and its resources itself.
|
to a Kubernetes cluster, troubleshoot them, and manage the cluster and its resources itself.
|
||||||
|
|
||||||
#### Third-Party Tools
|
#### Third-Party Tools
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ Kubernetes supports various third-party tools. These include, but are not limite
|
|||||||
[Kubernetes Helm](https://github.com/kubernetes/helm) is a tool for managing packages of pre-configured
|
[Kubernetes Helm](https://github.com/kubernetes/helm) is a tool for managing packages of pre-configured
|
||||||
Kubernetes resources, aka Kubernetes charts.
|
Kubernetes resources, aka Kubernetes charts.
|
||||||
|
|
||||||
Use Helm to:
|
Use Helm to:
|
||||||
|
|
||||||
* Find and use popular software packaged as Kubernetes charts
|
* Find and use popular software packaged as Kubernetes charts
|
||||||
* Share your own applications as Kubernetes charts
|
* Share your own applications as Kubernetes charts
|
||||||
@@ -45,10 +45,10 @@ Use Helm to:
|
|||||||
* Intelligently manage your Kubernetes manifest files
|
* Intelligently manage your Kubernetes manifest files
|
||||||
* Manage releases of Helm packages
|
* Manage releases of Helm packages
|
||||||
|
|
||||||
##### Kompose
|
##### Kompose
|
||||||
|
|
||||||
[Kompose](https://github.com/kubernetes-incubator/kompose) is a tool to help users familiar with Docker Compose
|
[Kompose](https://github.com/kubernetes-incubator/kompose) is a tool to help users familiar with Docker Compose
|
||||||
move to Kubernetes.
|
move to Kubernetes.
|
||||||
|
|
||||||
Use Kompose to:
|
Use Kompose to:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user