2016-02-24 21:47:57 +00:00
---
2018-02-20 22:18:39 +00:00
reviewers:
2016-07-29 17:36:25 +00:00
- erictune
- lavalamp
- thockin
2016-12-15 20:16:54 +00:00
title: Creating a Custom Cluster from Scratch
2016-02-24 21:47:57 +00:00
---
2016-03-07 02:29:06 +00:00
This guide is for people who want to craft a custom Kubernetes cluster. If you
can find an existing Getting Started Guide that meets your needs on [this
2017-10-10 02:17:59 +00:00
list](/docs/setup/), then we recommend using it, as you will be able to benefit
2016-03-07 02:29:06 +00:00
from the experience of others. However, if you have specific IaaS, networking,
configuration management, or operating system requirements not met by any of
those guides, then this guide will provide an outline of the steps you need to
take. Note that it requires considerably more effort than using one of the
pre-defined guides.
This guide is also useful for those wanting to understand at a high level some of the
steps that existing cluster setup scripts are making.
2018-05-05 16:00:51 +00:00
{{< toc > }}
2016-03-07 02:29:06 +00:00
## Designing and Preparing
### Learning
1. You should be familiar with using Kubernetes already. We suggest you set
up a temporary cluster by following one of the other Getting Started Guides.
2017-09-24 18:06:23 +00:00
This will help you become familiar with the CLI ([kubectl](/docs/user-guide/kubectl/)) and concepts ([pods](/docs/user-guide/pods/), [services ](/docs/concepts/services-networking/service/ ), etc.) first.
2016-03-07 02:29:06 +00:00
1. You should have `kubectl` installed on your desktop. This will happen as a side
effect of completing one of the other Getting Started Guides. If not, follow the instructions
2017-03-16 21:53:31 +00:00
[here ](/docs/tasks/kubectl/install/ ).
2016-03-07 02:29:06 +00:00
### Cloud Provider
Kubernetes has the concept of a Cloud Provider, which is a module which provides
an interface for managing TCP Load Balancers, Nodes (Instances) and Networking Routes.
The interface is defined in `pkg/cloudprovider/cloud.go` . It is possible to
create a custom cluster without implementing a cloud provider (for example if using
bare-metal), and not all parts of the interface need to be implemented, depending
on how flags are set on various components.
### Nodes
- You can use virtual or physical machines.
- While you can build a cluster with 1 machine, in order to run all the examples and tests you
need at least 4 nodes.
- Many Getting-started-guides make a distinction between the master node and regular nodes. This
is not strictly necessary.
- Nodes will need to run some version of Linux with the x86_64 architecture. It may be possible
to run on other OSes and Architectures, but this guide does not try to assist with that.
- Apiserver and etcd together are fine on a machine with 1 core and 1GB RAM for clusters with 10s of nodes.
Larger or more active clusters may benefit from more cores.
- Other nodes can have any reasonable amount of memory and any number of cores. They need not
have identical configurations.
### Network
2016-09-07 17:12:30 +00:00
#### Network Connectivity
2017-10-04 04:49:37 +00:00
Kubernetes has a distinctive [networking model ](/docs/concepts/cluster-administration/networking/ ).
2016-03-07 02:29:06 +00:00
Kubernetes allocates an IP address to each pod. When creating a cluster, you
need to allocate a block of IPs for Kubernetes to use as Pod IPs. The simplest
approach is to allocate a different block of IPs to each node in the cluster as
the node is added. A process in one pod should be able to communicate with
another pod using the IP of the second pod. This connectivity can be
2016-02-26 11:54:48 +00:00
accomplished in two ways:
2016-03-07 02:29:06 +00:00
2016-09-16 22:57:58 +00:00
- **Using an overlay network**
2017-09-09 00:44:41 +00:00
- An overlay network obscures the underlying network architecture from the
2017-10-23 18:51:48 +00:00
pod network through traffic encapsulation (for example vxlan).
2016-09-16 22:57:58 +00:00
- Encapsulation reduces performance, though exactly how much depends on your solution.
- **Without an overlay network**
2016-09-22 08:22:31 +00:00
- Configure the underlying network fabric (switches, routers, etc.) to be aware of pod IP addresses.
2017-09-09 00:44:41 +00:00
- This does not require the encapsulation provided by an overlay, and so can achieve
2016-09-16 22:57:58 +00:00
better performance.
2017-09-09 00:44:41 +00:00
Which method you choose depends on your environment and requirements. There are various ways
to implement one of the above options:
2016-09-16 22:57:58 +00:00
- **Use a network plugin which is called by Kubernetes**
- Kubernetes supports the [CNI ](https://github.com/containernetworking/cni ) network plugin interface.
2017-09-09 00:44:41 +00:00
- There are a number of solutions which provide plugins for Kubernetes (listed alphabetically):
2016-11-19 22:52:21 +00:00
- [Calico ](http://docs.projectcalico.org/ )
2016-03-07 02:29:06 +00:00
- [Flannel ](https://github.com/coreos/flannel )
- [Open vSwitch (OVS) ](http://openvswitch.org/ )
2016-11-19 22:52:21 +00:00
- [Romana ](http://romana.io/ )
- [Weave ](http://weave.works/ )
2017-09-23 10:41:18 +00:00
- [More found here ](/docs/admin/networking#how-to-achieve-this/ )
2016-09-16 22:57:58 +00:00
- You can also write your own.
- **Compile support directly into Kubernetes**
- This can be done by implementing the "Routes" interface of a Cloud Provider module.
2018-07-18 21:57:43 +00:00
- The Google Compute Engine ([GCE](/docs/setup/turnkey/gce/)) and [AWS ](/docs/setup/turnkey/aws/ ) guides use this approach.
2016-09-16 22:57:58 +00:00
- **Configure the network external to Kubernetes**
- This can be done by manually running commands, or through a set of externally maintained scripts.
- You have to implement this yourself, but it can give you an extra degree of flexibility.
2016-03-07 02:29:06 +00:00
2018-03-05 14:56:53 +00:00
You will need to select an address range for the Pod IPs.
2016-03-07 02:29:06 +00:00
- Various approaches:
- GCE: each project has its own `10.0.0.0/8` . Carve off a `/16` for each
Kubernetes cluster from that space, which leaves room for several clusters.
Each node gets a further subdivision of this space.
- AWS: use one VPC for whole organization, carve off a chunk for each
cluster, or use different VPC for different clusters.
- Allocate one CIDR subnet for each node's PodIPs, or a single large CIDR
2016-09-16 22:57:58 +00:00
from which smaller CIDRs are automatically allocated to each node.
2016-03-07 02:29:06 +00:00
- You need max-pods-per-node * max-number-of-nodes IPs in total. A `/24` per
node supports 254 pods per machine and is a common choice. If IPs are
scarce, a `/26` (62 pods per machine) or even a `/27` (30 pods) may be sufficient.
2017-10-23 18:51:48 +00:00
- For example, use `10.10.0.0/16` as the range for the cluster, with up to 256 nodes
2016-03-07 02:29:06 +00:00
using `10.10.0.0/24` through `10.10.255.0/24` , respectively.
- Need to make these routable or connect with overlay.
2017-09-24 18:06:23 +00:00
Kubernetes also allocates an IP to each [service ](/docs/concepts/services-networking/service/ ). However,
2016-03-07 02:29:06 +00:00
service IPs do not necessarily need to be routable. The kube-proxy takes care
of translating Service IPs to Pod IPs before traffic leaves the node. You do
2018-02-26 15:49:43 +00:00
need to allocate a block of IPs for services. Call this
2016-03-07 02:29:06 +00:00
`SERVICE_CLUSTER_IP_RANGE` . For example, you could set
`SERVICE_CLUSTER_IP_RANGE="10.0.0.0/16"` , allowing 65534 distinct services to
be active at once. Note that you can grow the end of this range, but you
cannot move it without disrupting the services and pods that already use it.
Also, you need to pick a static IP for master node.
2016-07-15 14:36:54 +00:00
2016-03-07 02:29:06 +00:00
- Call this `MASTER_IP` .
- Open any firewalls to allow access to the apiserver ports 80 and/or 443.
- Enable ipv4 forwarding sysctl, `net.ipv4.ip_forward = 1`
2016-09-07 17:12:30 +00:00
#### Network Policy
2017-06-21 18:11:53 +00:00
Kubernetes enables the definition of fine-grained network policy between Pods using the [NetworkPolicy ](/docs/concepts/services-networking/network-policies/ ) resource.
2016-09-07 17:12:30 +00:00
2017-04-19 17:56:47 +00:00
Not all networking providers support the Kubernetes NetworkPolicy API, see [Using Network Policy ](/docs/tasks/configure-pod-container/declare-network-policy/ ) for more information.
2016-09-07 17:12:30 +00:00
2016-03-07 02:29:06 +00:00
### Cluster Naming
You should pick a name for your cluster. Pick a short name for each cluster
2016-02-26 11:54:48 +00:00
which is unique from future cluster names. This will be used in several ways:
2016-03-07 02:29:06 +00:00
- by kubectl to distinguish between various clusters you have access to. You will probably want a
second one sometime later, such as for testing new Kubernetes releases, running in a different
region of the world, etc.
2017-10-23 18:51:48 +00:00
- Kubernetes clusters can create cloud provider resources (for example, AWS ELBs) and different clusters
2016-03-22 11:02:26 +00:00
need to distinguish which resources each created. Call this `CLUSTER_NAME` .
2016-03-07 02:29:06 +00:00
### Software Binaries
2016-02-26 11:54:48 +00:00
You will need binaries for:
2016-03-07 02:29:06 +00:00
- etcd
- A container runner, one of:
- docker
- rkt
- Kubernetes
- kubelet
- kube-proxy
- kube-apiserver
- kube-controller-manager
- kube-scheduler
#### Downloading and Extracting Kubernetes Binaries
A Kubernetes binary release includes all the Kubernetes binaries as well as the supported release of etcd.
You can use a Kubernetes binary release (recommended) or build your Kubernetes binaries following the instructions in the
2017-06-26 22:40:13 +00:00
[Developer Documentation ](https://git.k8s.io/community/contributors/devel/ ). Only using a binary release is covered in this guide.
2016-03-07 02:29:06 +00:00
Download the [latest binary release ](https://github.com/kubernetes/kubernetes/releases/latest ) and unzip it.
2017-06-23 08:03:52 +00:00
Server binary tarballs are no longer included in the Kubernetes final tarball, so you will need to locate and run
`./kubernetes/cluster/get-kube-binaries.sh` to download the client and server binaries.
2016-03-07 02:29:06 +00:00
Then locate `./kubernetes/server/kubernetes-server-linux-amd64.tar.gz` and unzip *that* .
Then, within the second set of unzipped files, locate `./kubernetes/server/bin` , which contains
all the necessary binaries.
#### Selecting Images
You will run docker, kubelet, and kube-proxy outside of a container, the same way you would run any system daemon, so
you just need the bare binaries. For etcd, kube-apiserver, kube-controller-manager, and kube-scheduler,
we recommend that you run these as containers, so you need an image to be built.
2016-02-26 11:54:48 +00:00
You have several choices for Kubernetes images:
2016-03-07 02:29:06 +00:00
- Use images hosted on Google Container Registry (GCR):
2018-04-06 19:13:09 +00:00
- For example `k8s.gcr.io/hyperkube:$TAG` , where `TAG` is the latest
2016-03-07 02:29:06 +00:00
release tag, which can be found on the [latest releases page ](https://github.com/kubernetes/kubernetes/releases/latest ).
- Ensure $TAG is the same tag as the release tag you are using for kubelet and kube-proxy.
2018-05-05 16:00:51 +00:00
- The [hyperkube ](https://releases.k8s.io/{{< param "githubbranch" >}}/cmd/hyperkube ) binary is an all in one binary
2016-03-21 18:41:24 +00:00
- `hyperkube kubelet ...` runs the kubelet, `hyperkube apiserver ...` runs an apiserver, etc.
2016-03-07 02:29:06 +00:00
- Build your own images.
- Useful if you are using a private registry.
- The release contains files such as `./kubernetes/server/bin/kube-apiserver.tar` which
can be converted into docker images using a command like
`docker load -i kube-apiserver.tar`
- You can verify if the image is loaded successfully with the right repository and tag using
command like `docker images`
2016-02-26 11:54:48 +00:00
For etcd, you can:
2016-03-06 17:55:12 +00:00
2018-04-06 19:13:09 +00:00
- Use images hosted on Google Container Registry (GCR), such as `k8s.gcr.io/etcd:2.2.1`
2016-03-07 02:29:06 +00:00
- Use images hosted on [Docker Hub ](https://hub.docker.com/search/?q=etcd ) or [Quay.io ](https://quay.io/repository/coreos/etcd ), such as `quay.io/coreos/etcd:v2.2.1`
- Use etcd binary included in your OS distro.
- Build your own image
- You can do: `cd kubernetes/cluster/images/etcd; make`
We recommend that you use the etcd version which is provided in the Kubernetes binary distribution. The Kubernetes binaries in the release
were tested extensively with this version of etcd and not with any other version.
2016-07-15 12:34:58 +00:00
The recommended version number can also be found as the value of `TAG` in `kubernetes/cluster/images/etcd/Makefile` .
2016-03-07 02:29:06 +00:00
2016-02-26 11:54:48 +00:00
The remainder of the document assumes that the image identifiers have been chosen and stored in corresponding env vars. Examples (replace with latest tags and appropriate registry):
2016-03-07 02:29:06 +00:00
2018-04-06 19:13:09 +00:00
- `HYPERKUBE_IMAGE=k8s.gcr.io/hyperkube:$TAG`
- `ETCD_IMAGE=k8s.gcr.io/etcd:$ETCD_VERSION`
2016-03-07 02:29:06 +00:00
### Security Models
2016-02-26 11:54:48 +00:00
There are two main options for security:
2016-03-07 02:29:06 +00:00
- Access the apiserver using HTTP.
- Use a firewall for security.
- This is easier to setup.
- Access the apiserver using HTTPS
- Use https with certs, and credentials for user.
- This is the recommended approach.
- Configuring certs can be tricky.
If following the HTTPS approach, you will need to prepare certs and credentials.
#### Preparing Certs
2016-02-26 11:54:48 +00:00
You need to prepare several certs:
2016-03-07 02:29:06 +00:00
- The master needs a cert to act as an HTTPS server.
- The kubelets optionally need certs to identify themselves as clients of the master, and when
serving its own API over HTTPS.
2016-07-15 12:38:14 +00:00
Unless you plan to have a real CA generate your certs, you will need
to generate a root cert and use that to sign the master, kubelet, and
kubectl certs. How to do this is described in the [authentication
2018-07-11 20:43:26 +00:00
documentation](/docs/concepts/cluster-administration/certificates/).
2016-03-07 02:29:06 +00:00
2016-03-06 17:55:12 +00:00
You will end up with the following files (we will use these variables later on)
2016-03-07 02:29:06 +00:00
- `CA_CERT`
2017-10-23 18:51:48 +00:00
- put in on node where apiserver runs, for example in `/srv/kubernetes/ca.crt` .
2016-03-07 02:29:06 +00:00
- `MASTER_CERT`
- signed by CA_CERT
2017-10-23 18:51:48 +00:00
- put in on node where apiserver runs, for example in `/srv/kubernetes/server.crt`
2016-03-07 02:29:06 +00:00
- `MASTER_KEY `
2017-10-23 18:51:48 +00:00
- put in on node where apiserver runs, for example in `/srv/kubernetes/server.key`
2016-03-07 02:29:06 +00:00
- `KUBELET_CERT`
- optional
- `KUBELET_KEY`
- optional
#### Preparing Credentials
2016-02-26 11:54:48 +00:00
The admin user (and any users) need:
2016-03-07 02:29:06 +00:00
- a token or a password to identify them.
2017-10-23 18:51:48 +00:00
- tokens are just long alphanumeric strings, 32 chars for example. See
2018-06-17 13:30:29 +00:00
- `TOKEN=$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64 | tr -d "=+/[:space:]" | dd bs=32 count=1 2>/dev/null)`
2016-03-07 02:29:06 +00:00
Your tokens and passwords need to be stored in a file for the apiserver
to read. This guide uses `/var/lib/kube-apiserver/known_tokens.csv` .
2018-07-11 20:43:26 +00:00
The format for this file is described in the [authentication documentation ](/docs/reference/access-authn-authz/authentication/#static-token-file ).
2016-03-07 02:29:06 +00:00
For distributing credentials to clients, the convention in Kubernetes is to put the credentials
2017-03-16 22:42:11 +00:00
into a [kubeconfig file ](/docs/concepts/cluster-administration/authenticate-across-clusters-kubeconfig/ ).
2016-03-07 02:29:06 +00:00
2016-02-26 11:54:48 +00:00
The kubeconfig file for the administrator can be created as follows:
2016-03-07 02:29:06 +00:00
- If you have already used Kubernetes with a non-custom cluster (for example, used a Getting Started
Guide), you will already have a `$HOME/.kube/config` file.
- You need to add certs, keys, and the master IP to the kubeconfig file:
- If using the firewall-only security option, set the apiserver this way:
- `kubectl config set-cluster $CLUSTER_NAME --server=http://$MASTER_IP --insecure-skip-tls-verify=true`
- Otherwise, do this to set the apiserver ip, client certs, and user credentials.
- `kubectl config set-cluster $CLUSTER_NAME --certificate-authority=$CA_CERT --embed-certs=true --server=https://$MASTER_IP`
- `kubectl config set-credentials $USER --client-certificate=$CLI_CERT --client-key=$CLI_KEY --embed-certs=true --token=$TOKEN`
- Set your cluster as the default cluster to use:
- `kubectl config set-context $CONTEXT_NAME --cluster=$CLUSTER_NAME --user=$USER`
- `kubectl config use-context $CONTEXT_NAME`
Next, make a kubeconfig file for the kubelets and kube-proxy. There are a couple of options for how
2016-02-26 11:54:48 +00:00
many distinct files to make:
2016-03-07 02:29:06 +00:00
1. Use the same credential as the admin
- This is simplest to setup.
1. One token and kubeconfig file for all kubelets, one for all kube-proxy, one for admin.
- This mirrors what is done on GCE today
1. Different credentials for every kubelet, etc.
- We are working on this but all the pieces are not ready yet.
2018-01-15 16:03:01 +00:00
You can make the files by copying the `$HOME/.kube/config` or by using the following template:
2016-03-07 02:29:06 +00:00
2016-02-26 11:54:48 +00:00
```yaml
2016-03-07 02:29:06 +00:00
apiVersion: v1
kind: Config
users:
- name: kubelet
user:
token: ${KUBELET_TOKEN}
clusters:
- name: local
cluster:
2016-07-15 14:47:01 +00:00
certificate-authority: /srv/kubernetes/ca.crt
2016-03-07 02:29:06 +00:00
contexts:
- context:
cluster: local
user: kubelet
name: service-account-context
current-context: service-account-context
2016-02-26 11:54:48 +00:00
```
2016-03-07 02:29:06 +00:00
Put the kubeconfig(s) on every node. The examples later in this
guide assume that there are kubeconfigs in `/var/lib/kube-proxy/kubeconfig` and
`/var/lib/kubelet/kubeconfig` .
## Configuring and Installing Base Software on Nodes
This section discusses how to configure machines to be Kubernetes nodes.
2016-02-26 11:54:48 +00:00
You should run three daemons on every node:
2016-03-07 02:29:06 +00:00
- docker or rkt
- kubelet
- kube-proxy
You will also need to do assorted other configuration on top of a
base OS install.
Tip: One possible starting point is to setup a cluster using an existing Getting
Started Guide. After getting a cluster running, you can then copy the init.d scripts or systemd unit files from that
cluster, and then modify them for use on your custom cluster.
### Docker
The minimum required Docker version will vary as the kubelet version changes. The newest stable release is a good choice. Kubelet will log a warning and refuse to start pods if the version is too old, so pick a version and try it.
If you previously had Docker installed on a node without setting Kubernetes-specific
options, you may have a Docker-created bridge and iptables rules. You may want to remove these
as follows before proceeding to configure Docker for Kubernetes.
2016-02-26 11:54:48 +00:00
```shell
2016-03-07 02:29:06 +00:00
iptables -t nat -F
2016-05-17 18:56:01 +00:00
ip link set docker0 down
ip link delete docker0
2016-02-26 11:54:48 +00:00
```
2016-03-07 02:29:06 +00:00
The way you configure docker will depend in whether you have chosen the routable-vip or overlay-network approaches for your network.
2016-02-26 11:54:48 +00:00
Some suggested docker options:
2016-03-07 02:29:06 +00:00
- create your own bridge for the per-node CIDR ranges, call it cbr0, and set `--bridge=cbr0` option on docker.
- set `--iptables=false` so docker will not manipulate iptables for host-ports (too coarse on older docker versions, may be fixed in newer versions)
so that kube-proxy can manage iptables instead of docker.
- `--ip-masq=false`
- if you have setup PodIPs to be routable, then you want this false, otherwise, docker will
rewrite the PodIP source-address to a NodeIP.
2017-10-23 18:51:48 +00:00
- some environments (for example GCE) still need you to masquerade out-bound traffic when it leaves the cloud environment. This is very environment specific.
2016-03-07 02:29:06 +00:00
- if you are using an overlay network, consult those instructions.
- `--mtu=`
- may be required when using Flannel, because of the extra packet size due to udp encapsulation
- `--insecure-registry $CLUSTER_SUBNET`
- to connect to a private registry, if you set one up, without using SSL.
2016-02-26 11:54:48 +00:00
You may want to increase the number of open files for docker:
2016-03-07 02:29:06 +00:00
- `DOCKER_NOFILE=1000000`
Where this config goes depends on your node OS. For example, GCE's Debian-based distro uses `/etc/default/docker` .
Ensure docker is working correctly on your system before proceeding with the rest of the
installation, by following examples given in the Docker documentation.
### rkt
[rkt ](https://github.com/coreos/rkt ) is an alternative to Docker. You only need to install one of Docker or rkt.
The minimum version required is [v0.5.6 ](https://github.com/coreos/rkt/releases/tag/v0.5.6 ).
[systemd ](http://www.freedesktop.org/wiki/Software/systemd/ ) is required on your node to run rkt. The
minimum version required to match rkt v0.5.6 is
[systemd 215 ](http://lists.freedesktop.org/archives/systemd-devel/2014-July/020903.html ).
2016-11-03 10:22:29 +00:00
[rkt metadata service ](https://github.com/coreos/rkt/blob/master/Documentation/networking/overview.md ) is also required
2016-03-07 02:29:06 +00:00
for rkt networking support. You can start rkt metadata service by using command like
`sudo systemd-run rkt metadata-service`
2016-02-26 11:54:48 +00:00
Then you need to configure your kubelet with flag:
2016-03-07 02:29:06 +00:00
- `--container-runtime=rkt`
### kubelet
2016-04-08 17:54:47 +00:00
All nodes should run kubelet. See [Software Binaries ](#software-binaries ).
2016-03-07 02:29:06 +00:00
2016-02-26 11:54:48 +00:00
Arguments to consider:
2016-03-07 02:29:06 +00:00
- If following the HTTPS security approach:
- `--kubeconfig=/var/lib/kubelet/kubeconfig`
- Otherwise, if taking the firewall-based security approach
- `--config=/etc/kubernetes/manifests`
- `--cluster-dns=` to the address of the DNS server you will setup (see [Starting Cluster Services ](#starting-cluster-services ).)
- `--cluster-domain=` to the dns domain prefix to use for cluster DNS addresses.
- `--docker-root=`
- `--root-dir=`
2017-10-19 18:15:33 +00:00
- `--pod-cidr=` The CIDR to use for pod IP addresses, only used in standalone mode. In cluster mode, this is obtained from the master.
2017-09-23 10:41:18 +00:00
- `--register-node` (described in [Node ](/docs/admin/node/ ) documentation.)
2016-03-07 02:29:06 +00:00
### kube-proxy
All nodes should run kube-proxy. (Running kube-proxy on a "master" node is not
strictly required, but being consistent is easier.) Obtain a binary as described for
kubelet.
2016-02-26 11:54:48 +00:00
Arguments to consider:
2016-03-07 02:29:06 +00:00
- If following the HTTPS security approach:
2016-04-05 10:27:12 +00:00
- `--master=https://$MASTER_IP`
2016-03-07 02:29:06 +00:00
- `--kubeconfig=/var/lib/kube-proxy/kubeconfig`
- Otherwise, if taking the firewall-based security approach
2016-04-05 10:27:12 +00:00
- `--master=http://$MASTER_IP`
2016-03-07 02:29:06 +00:00
2017-10-19 06:31:06 +00:00
Note that on some Linux platforms, you may need to manually install the
`conntrack` package which is a dependency of kube-proxy, or else kube-proxy
cannot be started successfully.
For more details on debugging kube-proxy problems, please refer to
[Debug Services ](/docs/tasks/debug-application-cluster/debug-service/ )
2016-03-07 02:29:06 +00:00
### Networking
Each node needs to be allocated its own CIDR range for pod networking.
Call this `NODE_X_POD_CIDR` .
A bridge called `cbr0` needs to be created on each node. The bridge is explained
2017-10-04 04:49:37 +00:00
further in the [networking documentation ](/docs/concepts/cluster-administration/networking/ ). The bridge itself
2016-03-07 02:29:06 +00:00
needs an address from `$NODE_X_POD_CIDR` - by convention the first IP. Call
this `NODE_X_BRIDGE_ADDR` . For example, if `NODE_X_POD_CIDR` is `10.0.0.0/16` ,
then `NODE_X_BRIDGE_ADDR` is `10.0.0.1/16` . NOTE: this retains the `/16` suffix
because of how this is used later.
If you have turned off Docker's IP masquerading to allow pods to talk to each
other, then you may need to do masquerading just for destination IPs outside
the cluster network. For example:
2016-02-26 11:54:48 +00:00
```shell
2016-03-07 02:29:06 +00:00
iptables -t nat -A POSTROUTING ! -d ${CLUSTER_SUBNET} -m addrtype ! --dst-type LOCAL -j MASQUERADE
2016-02-26 11:54:48 +00:00
```
2016-03-07 02:29:06 +00:00
This will rewrite the source address from
the PodIP to the Node IP for traffic bound outside the cluster, and kernel
[connection tracking ](http://www.iptables.info/en/connection-state.html )
will ensure that responses destined to the node still reach
the pod.
NOTE: This is environment specific. Some environments will not need
any masquerading at all. Others, such as GCE, will not allow pod IPs to send
traffic to the internet, but have no problem with them inside your GCE Project.
### Other
- Enable auto-upgrades for your OS package manager, if desired.
2017-10-23 18:51:48 +00:00
- Configure log rotation for all node components (for example using [logrotate ](http://linux.die.net/man/8/logrotate )).
- Setup liveness-monitoring (for example using [supervisord ](http://supervisord.org/ )).
2016-03-07 02:29:06 +00:00
- Setup volume plugin support (optional)
- Install any client binaries for optional volume types, such as `glusterfs-client` for GlusterFS
volumes.
### Using Configuration Management
The previous steps all involved "conventional" system administration techniques for setting up
machines. You may want to use a Configuration Management system to automate the node configuration
2018-07-17 07:29:38 +00:00
process. There are examples of [Saltstack ](/docs/setup/salt/ ), Ansible, Juju, and CoreOS Cloud Config in the
2016-03-07 02:29:06 +00:00
various Getting Started Guides.
## Bootstrapping the Cluster
While the basic node services (kubelet, kube-proxy, docker) are typically started and managed using
traditional system administration/automation approaches, the remaining *master* components of Kubernetes are
2016-02-26 11:54:48 +00:00
all configured and managed *by Kubernetes* :
2016-03-07 02:29:06 +00:00
2017-08-15 12:06:06 +00:00
- Their options are specified in a Pod spec (yaml or json) rather than an /etc/init.d file or
2016-03-07 02:29:06 +00:00
systemd unit.
2017-08-15 12:06:06 +00:00
- They are kept running by Kubernetes rather than by init.
2016-03-07 02:29:06 +00:00
### etcd
2016-02-26 11:54:48 +00:00
You will need to run one or more instances of etcd.
2016-03-07 02:29:06 +00:00
2017-08-01 10:39:52 +00:00
- Highly available and easy to restore - Run 3 or 5 etcd instances with, their logs written to a directory backed
by durable storage (RAID, GCE PD)
- Not highly available, but easy to restore - Run one etcd instance, with its log written to a directory backed
2017-10-23 18:51:48 +00:00
by durable storage (RAID, GCE PD).
2018-06-04 21:20:56 +00:00
{{< note > }}**Note:** May result in operations outages in case of
instance outage. {{< / note > }}
2017-08-01 10:39:52 +00:00
- Highly available - Run 3 or 5 etcd instances with non durable storage.
2017-10-23 18:51:48 +00:00
2018-06-04 21:20:56 +00:00
{{< note > }}**Note:** Log can be written to non-durable storage
because storage is replicated.{{< / note > }}
See [cluster-troubleshooting ](/docs/admin/cluster-troubleshooting/ ) for more discussion on factors affecting cluster
2016-03-07 02:29:06 +00:00
availability.
To run an etcd instance:
2018-01-19 05:20:36 +00:00
1. Copy [`cluster/gce/manifests/etcd.manifest` ](https://github.com/kubernetes/kubernetes/blob/master/cluster/gce/manifests/etcd.manifest )
2016-09-22 09:07:06 +00:00
1. Make any modifications needed
1. Start the pod by putting it into the kubelet manifest directory
2016-03-07 02:29:06 +00:00
### Apiserver, Controller Manager, and Scheduler
The apiserver, controller manager, and scheduler will each run as a pod on the master node.
For each of these components, the steps to start them running are similar:
1. Start with a provided template for a pod.
1. Set the `HYPERKUBE_IMAGE` to the values chosen in [Selecting Images ](#selecting-images ).
1. Determine which flags are needed for your cluster, using the advice below each template.
2017-10-23 18:51:48 +00:00
1. Set the flags to be individual strings in the command array (for example $ARGN below)
2016-03-07 02:29:06 +00:00
1. Start the pod by putting the completed template into the kubelet manifest directory.
1. Verify that the pod is started.
#### Apiserver pod template
2016-02-26 11:54:48 +00:00
```json
2016-03-07 02:29:06 +00:00
{
"kind": "Pod",
"apiVersion": "v1",
"metadata": {
"name": "kube-apiserver"
},
"spec": {
"hostNetwork": true,
"containers": [
{
"name": "kube-apiserver",
"image": "${HYPERKUBE_IMAGE}",
"command": [
"/hyperkube",
"apiserver",
"$ARG1",
"$ARG2",
...
"$ARGN"
],
"ports": [
{
"name": "https",
"hostPort": 443,
"containerPort": 443
},
{
"name": "local",
"hostPort": 8080,
"containerPort": 8080
}
],
"volumeMounts": [
{
"name": "srvkube",
"mountPath": "/srv/kubernetes",
"readOnly": true
},
{
"name": "etcssl",
"mountPath": "/etc/ssl",
"readOnly": true
}
],
"livenessProbe": {
"httpGet": {
2016-07-21 17:42:46 +00:00
"scheme": "HTTP",
"host": "127.0.0.1",
"port": 8080,
"path": "/healthz"
2016-03-07 02:29:06 +00:00
},
"initialDelaySeconds": 15,
"timeoutSeconds": 15
}
}
],
"volumes": [
{
"name": "srvkube",
"hostPath": {
"path": "/srv/kubernetes"
}
},
{
"name": "etcssl",
"hostPath": {
"path": "/etc/ssl"
}
}
]
}
}
2016-02-26 11:54:48 +00:00
```
2016-03-07 02:29:06 +00:00
Here are some apiserver flags you may need to set:
- `--cloud-provider=` see [cloud providers ](#cloud-providers )
- `--cloud-config=` see [cloud providers ](#cloud-providers )
- `--address=${MASTER_IP}` *or* `--bind-address=127.0.0.1` and `--address=127.0.0.1` if you want to run a proxy on the master node.
- `--service-cluster-ip-range=$SERVICE_CLUSTER_IP_RANGE`
- `--etcd-servers=http://127.0.0.1:4001`
- `--tls-cert-file=/srv/kubernetes/server.cert`
- `--tls-private-key-file=/srv/kubernetes/server.key`
Merge 1.10 to master for release (#7861)
* 1.10 update (#7151)
* Fix partition value expected behaviour explanation (#7123)
Fixes issue #7057
* Correct "On-Premise" to "On-Premises"
* Updates the Calico installation page (#7094)
* All files for Haufe Groups case study (#7051)
* Fix typo (#7127)
* fix typo of device-plugins.md (#7106)
* fix broken links (#7136)
* Updated configure-service-account (#7147)
Error from server resolved by escaping kubectl patch serviceaccount default -p '{"imagePullSecrets": [{"name": "myregistrykey"}]}' JSON string by '\'
* Remove docs related to 'require-kubeconfig' (#7138)
With kubernetes/kubernetes#58367 merged, v1.10 will not use the
"require-kubeconfig" flag. The flag has become a no-op solely to ensure
existing deployments won't break.
* Added Verification Scenario for a Pod that Uses a PVC in Terminating State (#7164)
The below PR:
https://github.com/kubernetes/kubernetes/pull/55873
modified scheduler in such a way that scheduling of a pod that uses a PVC in Terminating state fails.
That's why verification of such scenario was added to documentation.
* fix LimitPodHardAntiAffinityTopology name (#7221)
* Document the removal of the KubeletConfigFile feature gate (#7140)
With kubernetes/kubernetes#58978 merged, the said feature gate is
removed. This PR removes texts related to the gate and revises the
Feature Gates reference to reflect this change.
* deprecate three admission controller (#7363)
* Document the removal of Accelerators feature gate (#7389)
The `Accelerators` feature gate will be removed in 1.11. 1.10 will be
its last mile.
References: kubernetes/kubernetes#57384
* Update local storage docs for beta (#7473)
* Document that HugePages feature gate is Beta (#7387)
The `HugePages` feature gate has graduated to Beta in v1.10. This PR
documents this fact.
* Add HyperVContainer feature gates (#7502)
* Remove the beta reference from Taints and Tolerations doc (#7493)
* Kms provider doc (#7479)
* Kms provider doc
* issue# 7399, Create KMS-provider.md and update encrypt-data.md
* address review comments
* Document that Device Plugin feature is Beta (1.10) (#7512)
* Add docs for CRD features for 1.10 (#7439)
* Add docs for CRD features for 1.10
* Add CustomResourcesSubresources to list of feature gates
* Add latest changes to custom resources doc
* Add crds as abbreviated alias (#7437)
* Bring PVC Protection Feature to Beta (#7165)
* Bring PVC Protection Feature to Beta
The PR: https://github.com/kubernetes/kubernetes/pull/59052
brought PVC Protection feature to beta.
That's why the documentation is updated accordingly.
* The PVC Protection feature was renamed to Storage Protection. That's why the documentation is updated.
* promote PodNodeSelector to stable; document detailed behavior (#7134)
* promote PodNodeSelector to stable; document detailed behavior
* respond to feedback
* Update CPU manager feature enabling (#7390)
With `CPUManager` feature graduating to beta. No explicit enabling is
required starting v1.10.
References: kubernetes/kubernetes#55977
* Adding block volumeMode documentation for local volumes. (#7531)
Code review comments.
Changed property to field.
Address tech review comment.
* remove description kubectl --show-all (#7574)
--show-all has been deprecated and set to true by default.
https://github.com/kubernetes/kubernetes/pull/60210
* fix description about contribute style guide (#7592)
* fix description about KUBECONFIG (#7589)
s/envrionment/environment
* fix description about cni (#7588)
s/simultanously/simultaneously/
* fix description about MutatingAdmissionWebhook and ValidatingAdmissionWebhook (#7587)
* fix description about persistent volume binding (#7590)
s/slighty/slightly/
* Doc change for configurable pod resolv.conf Beta (#7611)
* fix description about out of resource handling (#7597)
s/threshhold/threshold
* fix description about zookeeper (#7598)
s/achive/achieve
* fix description about kubeadm (#7594)
s/compatability/compatibility/
* fix description about kubeadm (#7593)
* fix description about kubeadm implementation details (#7595)
* fix description about api concepts (#7596)
* Storage Protection was renamed to Storage Object in Use Protection (#7576)
* Storage Protection was renamed to Storage Object in Use Protection
The K8s PR: https://github.com/kubernetes/kubernetes/pull/59901
renamed Storage Protection to Storage Object in Use Protection.
That's why the same is also renamed in the documentation.
* Moved Storage Object in Use Protection admission plugin description down according to alphabetic order.
* Use PSP from policy API group. (#7562)
* update kubeletconfig docs for v1.10, beta (#7561)
* Update port-forwarding docs (#7575)
* add pv protection description (#7620)
* fix description about client library (#7634)
* Add docs on configuring NodePort IP (#7631)
* Document that LocalStorageCapacityIsolation is beta (#7635)
A follow-up to the kubernetes/kubernetes#60159 change which has promoted
the `LocalStorageCapacityIsolation` feature gate to Beta.
* Update CoreDNS docs for beta (#7638)
* Update CoreDNS docs for beta
* Review comments
* Fix typo (#7640)
* Update feature gates move to beta (#7662)
* Added the inability to use colon ':' character as environment variable names and described workaround (#7657)
* merge master to 1.10, with fixes (#7682)
* Flag names changed (s/admission-control/enable-admission-plugins); disable-admissions-plugin entry added; removed reference to admission controller/plugins requiring set order (for v1.10), redundant example enabling specific plugin, and redundant version-specific info (#7449)
* Documentation for MountPropagation beta (#7655)
* Remove job's scale-related operations (#7684)
* authentication: document client-go exec plugins (#7648)
* authentication: document client-go exec plugins
* Update authentication.md
* Update local ephemeral storage feature to beta (#7685)
Update local ephemeral storage feature to beta
* Update docs for windows container resources (#7653)
* add server-side print docs (#7671)
* Create a task describing Pod process namespace sharing (#7489)
* Add external metrics to HPA docs (#7664)
* Add external metrics to HPA docs
* Update horizontal-pod-autoscale-walkthrough.md
* Apply review comments to HPA walkthrough
* remove description about "scale jobs" (#7712)
* CSI Docs for K8s v1.10 (#7698)
* Add a warning about increased memory consumption for audit logging feature. (#7725)
Signed-off-by: Mik Vyatskov <vmik@google.com>
* Update Audit Logging documentation for 1.10 (#7679)
Signed-off-by: Mik Vyatskov <vmik@google.com>
* Fix stage names in audit logging documentation (#7746)
Signed-off-by: Mik Vyatskov <vmik@google.com>
* Feature gate update for release 1.10 (#7742)
* State in the docs that the value of default Node labels are not reliable. (#7794)
* Kill the reference to --admission-control option (#7755)
The `--admission-control` option has been replaced by two new options in
v1.10. This PR kills the last appearance of the old option in the doc.
* Pvcprotection toc (#7807)
* Refreshing installation instructions (#7495)
* Refreshing installation instructions
Added conjure-up. Updated displays and juju versions to current versions.
* Updated anchors
* Fixed image value version typo (#7768)
Was inconsistent with other values
* Update flocker reference to the github repo (#7784)
* Fix typo in federation document (#7779)
* an user -> a user (#7778)
* Events are namespaced (#7767)
* fix 'monitoring' link lose efficacy problem' (#7764)
* docs/concepts/policy/pod-security-policy.md: minor fix. (#7659)
* Update downward-api-volume-expose-pod-information.md (#7771)
* Update downward-api-volume-expose-pod-information.md
The pod spec puts the downward api files into /etc/podinfo, not directly in /etc. Updated docs to reflect this fact.
* Update downward-api-volume-expose-pod-information.md
One more spot needed fixing.
* Update downward-api-volume-expose-pod-information.md
Yet another fix, in the container example.
* Add Amadeus Case Study (#7783)
* Add Amadeus Case Study
* add Amadeus logo
* Fixed Cyrillic с in 'kube-proxy-cm' (#7787)
There was a typo (wrong character) in kube-proxy-cm.yaml - Cyrillic с (UTF-8 0x0441) was used instead of Latin c.
* install-kubectl: choose one installation method (#7705)
The previous text layout suggested that all installations had to be done, one after another.
* Update install-kubeadm.md (#7781)
Add note to kubeadm install instruction to help install in other arch i.e. aarch64, ppc64le etc.
* repair failure link (#7788)
* repair failure link
* repair failure link
* do change as required
* Update k8s201.md (#7777)
* Update k8s201.md
Change instructions to download yams files directly from the website (as used in other pages.)
Added instructions to delete labeled pod to avoid warnings in the subsequent deployment step.
* Update k8s201.md
Added example of using the exposed host from the a node running Kubernetes. (This works on AWS with Weave; not able to test it on other variations...)
* Gramatical fix to kompose introduction (#7792)
The original wording didn't through very well. As much of the original sentence has been preserved as possible, primarily to ensure the kompose web address is see both in text and as a href link.
* update amadeus.html (#7800)
* Fix a missing word in endpoint reconciler section (#7804)
* add toc entry for pvcprotection downgrade issue doc
* Pvcprotection toc (#7809)
* Refreshing installation instructions (#7495)
* Refreshing installation instructions
Added conjure-up. Updated displays and juju versions to current versions.
* Updated anchors
* Fixed image value version typo (#7768)
Was inconsistent with other values
* Update flocker reference to the github repo (#7784)
* Fix typo in federation document (#7779)
* an user -> a user (#7778)
* Events are namespaced (#7767)
* fix 'monitoring' link lose efficacy problem' (#7764)
* docs/concepts/policy/pod-security-policy.md: minor fix. (#7659)
* Update downward-api-volume-expose-pod-information.md (#7771)
* Update downward-api-volume-expose-pod-information.md
The pod spec puts the downward api files into /etc/podinfo, not directly in /etc. Updated docs to reflect this fact.
* Update downward-api-volume-expose-pod-information.md
One more spot needed fixing.
* Update downward-api-volume-expose-pod-information.md
Yet another fix, in the container example.
* Add Amadeus Case Study (#7783)
* Add Amadeus Case Study
* add Amadeus logo
* Fixed Cyrillic с in 'kube-proxy-cm' (#7787)
There was a typo (wrong character) in kube-proxy-cm.yaml - Cyrillic с (UTF-8 0x0441) was used instead of Latin c.
* install-kubectl: choose one installation method (#7705)
The previous text layout suggested that all installations had to be done, one after another.
* Update install-kubeadm.md (#7781)
Add note to kubeadm install instruction to help install in other arch i.e. aarch64, ppc64le etc.
* repair failure link (#7788)
* repair failure link
* repair failure link
* do change as required
* Update k8s201.md (#7777)
* Update k8s201.md
Change instructions to download yams files directly from the website (as used in other pages.)
Added instructions to delete labeled pod to avoid warnings in the subsequent deployment step.
* Update k8s201.md
Added example of using the exposed host from the a node running Kubernetes. (This works on AWS with Weave; not able to test it on other variations...)
* Gramatical fix to kompose introduction (#7792)
The original wording didn't through very well. As much of the original sentence has been preserved as possible, primarily to ensure the kompose web address is see both in text and as a href link.
* update amadeus.html (#7800)
* Fix a missing word in endpoint reconciler section (#7804)
* add toc entry for pvcprotection downgrade issue doc
* revert TOC change
* Release 1.10 (#7818)
* Refreshing installation instructions (#7495)
* Refreshing installation instructions
Added conjure-up. Updated displays and juju versions to current versions.
* Updated anchors
* Fixed image value version typo (#7768)
Was inconsistent with other values
* Update flocker reference to the github repo (#7784)
* Fix typo in federation document (#7779)
* an user -> a user (#7778)
* Events are namespaced (#7767)
* fix 'monitoring' link lose efficacy problem' (#7764)
* docs/concepts/policy/pod-security-policy.md: minor fix. (#7659)
* Update downward-api-volume-expose-pod-information.md (#7771)
* Update downward-api-volume-expose-pod-information.md
The pod spec puts the downward api files into /etc/podinfo, not directly in /etc. Updated docs to reflect this fact.
* Update downward-api-volume-expose-pod-information.md
One more spot needed fixing.
* Update downward-api-volume-expose-pod-information.md
Yet another fix, in the container example.
* Add Amadeus Case Study (#7783)
* Add Amadeus Case Study
* add Amadeus logo
* Fixed Cyrillic с in 'kube-proxy-cm' (#7787)
There was a typo (wrong character) in kube-proxy-cm.yaml - Cyrillic с (UTF-8 0x0441) was used instead of Latin c.
* install-kubectl: choose one installation method (#7705)
The previous text layout suggested that all installations had to be done, one after another.
* Update install-kubeadm.md (#7781)
Add note to kubeadm install instruction to help install in other arch i.e. aarch64, ppc64le etc.
* repair failure link (#7788)
* repair failure link
* repair failure link
* do change as required
* Update k8s201.md (#7777)
* Update k8s201.md
Change instructions to download yams files directly from the website (as used in other pages.)
Added instructions to delete labeled pod to avoid warnings in the subsequent deployment step.
* Update k8s201.md
Added example of using the exposed host from the a node running Kubernetes. (This works on AWS with Weave; not able to test it on other variations...)
* Gramatical fix to kompose introduction (#7792)
The original wording didn't through very well. As much of the original sentence has been preserved as possible, primarily to ensure the kompose web address is see both in text and as a href link.
* update amadeus.html (#7800)
* Fix a missing word in endpoint reconciler section (#7804)
* Partners page updates (#7802)
* Partners page updates
* Update to ZTE link
* Make using sysctls a task instead of a concept (#6808)
Closes: #4505
* add a note when mount a configmap to pod (#7745)
* adjust a note format (#7812)
* Update docker-cli-to-kubectl.md (#7748)
* Update docker-cli-to-kubectl.md
Edited the document for adherence to the style guide and word usage.
* Update docker-cli-to-kubectl.md
* Incorporated the changes suggested.
* Mount propagation update to include docker config (#7854)
* update overridden config for 1.10 (#7847)
* update overridden config for 1.10
* fix config file per comments
* Update Extended Resource doc wrt cluster-level resources (#7759)
2018-03-27 01:33:11 +00:00
- `--enable-admission-plugins=$RECOMMENDED_LIST`
2018-07-18 22:54:21 +00:00
- See [admission controllers ](/docs/reference/access-authn-authz/admission-controllers/ ) for recommended arguments.
2016-03-07 02:29:06 +00:00
- `--allow-privileged=true` , only if you trust your cluster user to run pods as root.
If you are following the firewall-only security approach, then use these arguments:
- `--token-auth-file=/dev/null`
- `--insecure-bind-address=$MASTER_IP`
- `--advertise-address=$MASTER_IP`
If you are using the HTTPS approach, then set:
2016-07-15 17:07:02 +00:00
2016-03-07 02:29:06 +00:00
- `--client-ca-file=/srv/kubernetes/ca.crt`
- `--token-auth-file=/srv/kubernetes/known_tokens.csv`
- `--basic-auth-file=/srv/kubernetes/basic_auth.csv`
2016-02-26 11:54:48 +00:00
This pod mounts several node file system directories using the `hostPath` volumes. Their purposes are:
2016-03-07 02:29:06 +00:00
- The `/etc/ssl` mount allows the apiserver to find the SSL root certs so it can
authenticate external services, such as a cloud provider.
2017-10-23 18:51:48 +00:00
- This is not required if you do not use a cloud provider (bare-metal for example).
2016-03-07 02:29:06 +00:00
- The `/srv/kubernetes` mount allows the apiserver to read certs and credentials stored on the
node disk. These could instead be stored on a persistent disk, such as a GCE PD, or baked into the image.
- Optionally, you may want to mount `/var/log` as well and redirect output there (not shown in template).
- Do this if you prefer your logs to be accessible from the root filesystem with tools like journalctl.
*TODO* document proxy-ssh setup.
##### Cloud Providers
Apiserver supports several cloud providers.
2018-05-17 22:53:50 +00:00
- options for `--cloud-provider` flag are `aws` , `azure` , `cloudstack` , `fake` , `gce` , `mesos` , `openstack` , `ovirt` , `rackspace` , `vsphere` , or unset.
2017-10-23 18:51:48 +00:00
- unset used for bare metal setups.
2018-05-05 16:00:51 +00:00
- support for new IaaS is added by contributing code [here ](https://releases.k8s.io/{{< param "githubbranch" >}}/pkg/cloudprovider/providers )
2016-03-07 02:29:06 +00:00
Some cloud providers require a config file. If so, you need to put config file into apiserver image or mount through hostPath.
- `--cloud-config=` set if cloud provider requires a config file.
2017-10-05 17:18:38 +00:00
- Used by `aws` , `gce` , `mesos` , `openstack` , `ovirt` and `rackspace` .
2016-03-07 02:29:06 +00:00
- You must put config file into apiserver image or mount through hostPath.
- Cloud config file syntax is [Gcfg ](https://code.google.com/p/gcfg/ ).
2018-05-05 16:00:51 +00:00
- AWS format defined by type [AWSCloudConfig ](https://releases.k8s.io/{{< param "githubbranch" >}}/pkg/cloudprovider/providers/aws/aws.go )
2016-03-07 02:29:06 +00:00
- There is a similar type in the corresponding file for other cloud providers.
#### Scheduler pod template
Complete this template for the scheduler pod:
2016-02-26 11:54:48 +00:00
```json
2016-03-07 02:29:06 +00:00
{
"kind": "Pod",
"apiVersion": "v1",
"metadata": {
"name": "kube-scheduler"
},
"spec": {
"hostNetwork": true,
"containers": [
{
"name": "kube-scheduler",
2017-12-16 02:59:08 +00:00
"image": "$HYPERKUBE_IMAGE",
2016-03-07 02:29:06 +00:00
"command": [
"/hyperkube",
"scheduler",
"--master=127.0.0.1:8080",
"$SCHEDULER_FLAG1",
...
"$SCHEDULER_FLAGN"
],
"livenessProbe": {
"httpGet": {
2016-07-21 17:42:46 +00:00
"scheme": "HTTP",
2016-07-20 11:01:25 +00:00
"host": "127.0.0.1",
2016-07-21 17:42:46 +00:00
"port": 10251,
"path": "/healthz"
2016-03-07 02:29:06 +00:00
},
"initialDelaySeconds": 15,
"timeoutSeconds": 15
}
}
]
}
}
2016-02-26 11:54:48 +00:00
```
2016-03-07 02:29:06 +00:00
Typically, no additional flags are required for the scheduler.
Optionally, you may want to mount `/var/log` as well and redirect output there.
#### Controller Manager Template
Template for controller manager pod:
2016-02-26 11:54:48 +00:00
```json
2016-03-07 02:29:06 +00:00
{
"kind": "Pod",
"apiVersion": "v1",
"metadata": {
"name": "kube-controller-manager"
},
"spec": {
"hostNetwork": true,
"containers": [
{
"name": "kube-controller-manager",
"image": "$HYPERKUBE_IMAGE",
"command": [
"/hyperkube",
"controller-manager",
"$CNTRLMNGR_FLAG1",
...
"$CNTRLMNGR_FLAGN"
],
"volumeMounts": [
{
"name": "srvkube",
"mountPath": "/srv/kubernetes",
"readOnly": true
},
{
"name": "etcssl",
"mountPath": "/etc/ssl",
"readOnly": true
}
],
"livenessProbe": {
"httpGet": {
2016-07-21 17:42:46 +00:00
"scheme": "HTTP",
2016-03-07 02:29:06 +00:00
"host": "127.0.0.1",
2016-07-21 17:42:46 +00:00
"port": 10252,
"path": "/healthz"
2016-03-07 02:29:06 +00:00
},
"initialDelaySeconds": 15,
"timeoutSeconds": 15
}
}
],
"volumes": [
{
"name": "srvkube",
"hostPath": {
"path": "/srv/kubernetes"
}
},
{
"name": "etcssl",
"hostPath": {
"path": "/etc/ssl"
}
}
]
}
}
2016-02-26 11:54:48 +00:00
```
Flags to consider using with controller manager:
2016-03-07 02:29:06 +00:00
2017-01-10 01:18:17 +00:00
- `--cluster-cidr=` , the CIDR range for pods in cluster.
- `--allocate-node-cidrs=` , if you are using `--cloud-provider=` , allocate and set the CIDRs for pods on the cloud provider.
2016-03-07 02:29:06 +00:00
- `--cloud-provider=` and `--cloud-config` as described in apiserver section.
- `--service-account-private-key-file=/srv/kubernetes/server.key` , used by the [service account ](/docs/user-guide/service-accounts ) feature.
- `--master=127.0.0.1:8080`
#### Starting and Verifying Apiserver, Scheduler, and Controller Manager
Place each completed pod template into the kubelet config dir
(whatever `--config=` argument of kubelet is set to, typically
`/etc/kubernetes/manifests` ). The order does not matter: scheduler and
controller manager will retry reaching the apiserver until it is up.
Use `ps` or `docker ps` to verify that each process has started. For example, verify that kubelet has started a container for the apiserver like this:
2016-02-26 11:54:48 +00:00
```shell
2017-09-18 09:00:44 +00:00
$ sudo docker ps | grep apiserver
2018-04-06 19:13:09 +00:00
5783290746d5 k8s.gcr.io/kube-apiserver:e36bf367342b5a80d7467fd7611ad873 "/bin/sh -c '/usr/lo'" 10 seconds ago Up 9 seconds k8s_kube-apiserver.feb145e7_kube-apiserver-kubernetes-master_default_eaebc600cf80dae59902b44225f2fc0a_225a4695
2016-02-26 11:54:48 +00:00
```
2016-03-07 02:29:06 +00:00
Then try to connect to the apiserver:
2016-02-26 11:54:48 +00:00
```shell
2016-03-07 02:29:06 +00:00
$ echo $(curl -s http://localhost:8080/healthz)
ok
$ curl -s http://localhost:8080/api
{
"versions": [
"v1"
]
}
2016-02-26 11:54:48 +00:00
```
2016-03-07 02:29:06 +00:00
If you have selected the `--register-node=true` option for kubelets, they will now begin self-registering with the apiserver.
You should soon be able to see all your nodes by running the `kubectl get nodes` command.
Otherwise, you will need to manually create node objects.
2016-03-06 17:55:12 +00:00
### Starting Cluster Services
2016-03-07 02:29:06 +00:00
You will want to complete your Kubernetes clusters by adding cluster-wide
2016-03-06 17:55:12 +00:00
services. These are sometimes called *addons* , and [an overview
of their purpose is in the admin guide](/docs/admin/cluster-components/#addons).
2016-03-07 02:29:06 +00:00
Notes for setting up each cluster service are given below:
* Cluster DNS:
2017-08-15 12:06:06 +00:00
* Required for many Kubernetes examples
2018-05-05 16:00:51 +00:00
* [Setup instructions ](http://releases.k8s.io/{{< param "githubbranch" >}}/cluster/addons/dns/ )
2017-04-19 17:56:47 +00:00
* [Admin Guide ](/docs/concepts/services-networking/dns-pod-service/ )
2016-03-06 17:55:12 +00:00
* Cluster-level Logging
2017-09-23 10:41:18 +00:00
* [Cluster-level Logging Overview ](/docs/user-guide/logging/overview/ )
* [Cluster-level Logging with Elasticsearch ](/docs/user-guide/logging/elasticsearch/ )
* [Cluster-level Logging with Stackdriver Logging ](/docs/user-guide/logging/stackdriver/ )
2016-03-07 02:29:06 +00:00
* Container Resource Monitoring
2018-05-05 16:00:51 +00:00
* [Setup instructions ](http://releases.k8s.io/{{< param "githubbranch" >}}/cluster/addons/cluster-monitoring/ )
2016-03-07 02:29:06 +00:00
* GUI
2017-12-24 04:51:03 +00:00
* [Setup instructions ](https://github.com/kubernetes/dashboard )
2016-03-07 02:29:06 +00:00
## Troubleshooting
### Running validate-cluster
2016-09-14 18:08:24 +00:00
`cluster/validate-cluster.sh` is used by `cluster/kube-up.sh` to determine if
the cluster start succeeded.
2016-09-14 01:31:29 +00:00
Example usage and output:
```shell
KUBECTL_PATH=$(which kubectl) NUM_NODES=3 KUBERNETES_PROVIDER=local cluster/validate-cluster.sh
Found 3 node(s).
2017-09-05 03:00:37 +00:00
NAME STATUS AGE VERSION
node1.local Ready 1h v1.6.9+a3d1dfa6f4335
node2.local Ready 1h v1.6.9+a3d1dfa6f4335
node3.local Ready 1h v1.6.9+a3d1dfa6f4335
2016-09-14 01:31:29 +00:00
Validate output:
NAME STATUS MESSAGE ERROR
controller-manager Healthy ok
scheduler Healthy ok
etcd-1 Healthy {"health": "true"}
etcd-2 Healthy {"health": "true"}
etcd-0 Healthy {"health": "true"}
Cluster validation succeeded
```
2016-03-07 02:29:06 +00:00
### Inspect pods and services
2018-07-18 21:57:43 +00:00
Try to run through the "Inspect your cluster" section in one of the other Getting Started Guides, such as [GCE ](/docs/setup/turnkey/gce/#inspect-your-cluster ).
2016-03-07 02:29:06 +00:00
You should see some services. You should also see "mirror pods" for the apiserver, scheduler and controller-manager, plus any add-ons you started.
### Try Examples
2018-06-26 16:34:52 +00:00
At this point you should be able to run through one of the basic examples, such as the [nginx example ](/examples/application/deployment.yaml ).
2016-03-07 02:29:06 +00:00
### Running the Conformance Test
2018-05-05 16:00:51 +00:00
You may want to try to run the [Conformance test ](http://releases.k8s.io/{{< param "githubbranch" >}}/test/e2e_node/conformance/run_test.sh ). Any failures may give a hint as to areas that need more attention.
2016-03-07 02:29:06 +00:00
### Networking
The nodes must be able to connect to each other using their private IP. Verify this by
pinging or SSH-ing from one node to another.
### Getting Help
2018-07-18 21:57:43 +00:00
If you run into trouble, please see the section on [troubleshooting ](/docs/setup/turnkey/gce/#troubleshooting ), post to the
2016-08-10 06:51:56 +00:00
[kubernetes-users group ](https://groups.google.com/forum/#!forum/kubernetes-users ), or come ask questions on [Slack ](/docs/troubleshooting#slack ).
2016-05-22 22:33:46 +00:00
## Support Level
IaaS Provider | Config. Mgmt | OS | Networking | Docs | Conforms | Support Level
-------------------- | ------------ | ------ | ---------- | --------------------------------------------- | ---------| ----------------------------
2017-09-25 20:43:15 +00:00
any | any | any | any | [docs ](/docs/getting-started-guides/scratch/ ) | | Community ([@erictune](https://github.com/erictune))
2016-05-22 22:33:46 +00:00
2017-09-25 20:43:15 +00:00
For support level information on all solutions, see the [Table of solutions ](/docs/getting-started-guides/#table-of-solutions/ ) chart.