mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-17 15:50:10 +00:00
update cloud_config with instructions on required changes and add network.md, correct links in quick_start
This commit is contained in:
parent
13acb63fb3
commit
6e570eb5bb
@ -4,31 +4,72 @@ The recommended way to run Kubernetes on CoreOS is to use [Cloud-Config](https:/
|
|||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
### Standalone
|
Node specification
|
||||||
|
|
||||||
The standalone cloud-config file can be used to setup a single node Kubernetes cluster.
|
Get the cloud-config templates which we'll be editing in place for this example:
|
||||||
|
|
||||||
* [standalone.yml](configs/standalone.yml)
|
|
||||||
|
|
||||||
### Cluster
|
|
||||||
|
|
||||||
The following cloud-config files can be used to setup a three node Kubernetes cluster.
|
|
||||||
|
|
||||||
* [master.yml](configs/master.yml)
|
|
||||||
* [node1.yml](configs/node1.yml)
|
|
||||||
* [node2.yml](configs/node2.yml)
|
|
||||||
|
|
||||||
### Creating config-drives
|
|
||||||
|
|
||||||
```
|
|
||||||
mkdir -p /tmp/new-drive/openstack/latest/
|
|
||||||
mkdir -p ~/iso
|
|
||||||
```
|
|
||||||
```
|
```
|
||||||
git clone https://github.com/GoogleCloudPlatform/kubernetes.git
|
git clone https://github.com/GoogleCloudPlatform/kubernetes.git
|
||||||
cd kubernetes/docs/getting-started-guides/coreos/configs
|
cd kubernetes/docs/getting-started-guides/coreos/configs
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Standalone
|
||||||
|
|
||||||
|
The standalone cloud-config file can be used to setup a single node Kubernetes cluster that has had CoreOS installed.
|
||||||
|
|
||||||
|
* [standalone.yml](configs/standalone.yml)
|
||||||
|
|
||||||
|
Skip to 'Configure Access'.
|
||||||
|
|
||||||
|
|
||||||
|
### Cluster
|
||||||
|
|
||||||
|
These are the current instructions for [Kelsey Hightowers blog post Running Kubernetes on CoreOS Part 2](https://coreos.com/blog/running-kubernetes-example-on-CoreOS-part-2/)
|
||||||
|
which provides a good background context for understanding Kubernetes and how to set this up using VMWare Fusion Pro.
|
||||||
|
|
||||||
|
#### Machine Configuration
|
||||||
|
To start we'll need 3 nodes for our cluster with the following:
|
||||||
|
* 1 CPU
|
||||||
|
* 512 MB RAM
|
||||||
|
* 20 GB HDD
|
||||||
|
* 2 Network Interfaces
|
||||||
|
* CD ROM (to install CoreOS and to provide configuration from [cloud-drive] (http://coreos.com/docs/cluster-management/setup/cloudinit-config-drive/)
|
||||||
|
|
||||||
|
The primary network interface for each machine should be on a network with access to the outside world in order to
|
||||||
|
update CoreOS, access the Docker repository, download Kubernetes, etc. The second interface on each machine should each
|
||||||
|
be connected to a switch. (VMWare Fusion Pro users can create a custom network with DHCP and NAT disabled that these
|
||||||
|
secondary interfaces connected to - see [the blog post](https://coreos.com/blog/running-kubernetes-example-on-CoreOS-part-2/)
|
||||||
|
for screenshots).
|
||||||
|
|
||||||
|
Boot each node from the [CoreOS](https://coreos.com/) ISO. Hit 'Return' a few times in the console window of a node.
|
||||||
|
Above the login prompt CoreOS lists the names it has generated for the network interfaces followed by the IP address it
|
||||||
|
has been assigned. Note the first interface name, and proceed to install CoreOS.
|
||||||
|
|
||||||
|
#### Cloud Configuration
|
||||||
|
The following cloud-config templates are used to setup a three node Kubernetes cluster.
|
||||||
|
* [master.yml](configs/master.yml)
|
||||||
|
* [node1.yml](configs/node1.yml)
|
||||||
|
* [node2.yml](configs/node2.yml)
|
||||||
|
|
||||||
|
Search for occurrences of 'ens33' in these templates and replace with the interface name provided by CoreOS.
|
||||||
|
|
||||||
|
Replace all occurrences of '192.168.12.10' with the IP address you wish to apply to the master node, '192.168.12.11'
|
||||||
|
with the IP address to assign to node1, '192.168.12.12' with IP address for node2. In the section
|
||||||
|
'coreos/units/static.network' set the DNS and Gateway entries to match your network. (VMWare Fusion users can find this
|
||||||
|
information in: "/Library/Preferences/VMware Fusion/vmnet8/dhcpd.conf" see [the blog post](https://coreos.com/blog/running-kubernetes-example-on-CoreOS-part-2/) )
|
||||||
|
|
||||||
|
### Configure Access
|
||||||
|
|
||||||
|
For both the standalone and cluster configurations, the final change required to the cloud-config file(s) is to replace
|
||||||
|
<ssh_public_key> with your public ssh key (typically the contents of ~/.ssh/id_rsa.pub).
|
||||||
|
|
||||||
|
### Create config-drives
|
||||||
|
|
||||||
|
Now create the ISO images that cloud-config will access when booting your node(s).
|
||||||
|
|
||||||
|
```
|
||||||
|
mkdir -p /tmp/new-drive/openstack/latest/
|
||||||
|
mkdir -p ~/iso
|
||||||
|
```
|
||||||
Using Linux:
|
Using Linux:
|
||||||
```
|
```
|
||||||
for i in standalone master node1 node2; do
|
for i in standalone master node1 node2; do
|
||||||
@ -45,10 +86,14 @@ for i in standalone master node1 node2; do
|
|||||||
done
|
done
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Make each ISO file accessible to its corresponding node by using it to define a cd/dvd drive for the VM (or create a
|
||||||
|
physical CD for bare metal), and boot the node. At the consoles login prompt, confirm the configured IP address for the
|
||||||
|
node is listed next to the interface name.
|
||||||
|
|
||||||
## Remote Access
|
## Remote Access
|
||||||
|
|
||||||
Setup a SSH tunnel to the Kubernetes API Server.
|
Setup a SSH tunnel to the Kubernetes API Server, replacing ${APISERVER} with the IP address of your master or
|
||||||
|
standalone node.
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo ssh -f -nNT -L 8080:127.0.0.1:8080 core@${APISERVER}
|
sudo ssh -f -nNT -L 8080:127.0.0.1:8080 core@${APISERVER}
|
||||||
@ -73,3 +118,12 @@ Issue commands remotely using the kubecfg command line tool.
|
|||||||
```
|
```
|
||||||
kubecfg list /pods
|
kubecfg list /pods
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Test a sample pod:
|
||||||
|
|
||||||
|
````
|
||||||
|
kubecfg -c examples/guestbook-go/redis-master-pod.json create pods
|
||||||
|
kubecfg list /pods
|
||||||
|
```
|
||||||
|
|
||||||
|
Your pod should now be listed as 'running'.
|
@ -1,6 +1,8 @@
|
|||||||
# CoreOS Quick Start Guide
|
# CoreOS Quick Start Guide
|
||||||
|
|
||||||
The following steps will setup a single node Kubernetes cluster. For a more robust setup using cloud-config see the [Installation Guide](docs/installation.md).
|
The following steps will setup a single node Kubernetes cluster. For a more robust setup using cloud-config see the
|
||||||
|
[Installation Guide](coreos_cloud_config.md) which automates the entire set-up. Those not installing via cloud-config
|
||||||
|
need to define the required network configuration from in the [Network Guide](networking.md).
|
||||||
|
|
||||||
### Install Kubernetes binaries
|
### Install Kubernetes binaries
|
||||||
|
|
||||||
|
65
docs/getting-started-guides/coreos/networking.md
Normal file
65
docs/getting-started-guides/coreos/networking.md
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
# Network Setup Guide
|
||||||
|
|
||||||
|
This guide demostrates a network setup that will work for environments with access to layer 2 networking
|
||||||
|
(bare metal, vmware, etc). The following steps are not required when following the [Installation Guide](coreos_cloud_config.md).
|
||||||
|
|
||||||
|
## Hostnames
|
||||||
|
|
||||||
|
On each node ensure the hostname is set.
|
||||||
|
|
||||||
|
```
|
||||||
|
hostnamectl set-hostname master
|
||||||
|
hostnamectl set-hostname node1
|
||||||
|
hostnamectl set-hostname node2
|
||||||
|
```
|
||||||
|
|
||||||
|
### Setup /etc/hosts
|
||||||
|
|
||||||
|
On each node add the following lines to /etc/hosts:
|
||||||
|
|
||||||
|
```
|
||||||
|
192.168.12.10 master
|
||||||
|
192.168.12.11 node1
|
||||||
|
192.168.12.12 node2
|
||||||
|
```
|
||||||
|
|
||||||
|
## Create the cbr0 bridge
|
||||||
|
|
||||||
|
On each node run the following commands to setup the cbr0 bridge used by Docker and Kubernetes.
|
||||||
|
|
||||||
|
```
|
||||||
|
brctl addbr cbr0
|
||||||
|
brctl addif cbr0 ens34
|
||||||
|
ip link set dev cbr0 mtu 1460
|
||||||
|
ip addr add 10.244.0.1/24 dev cbr0 # this will be different for each minion
|
||||||
|
ip link set dev cbr0 up
|
||||||
|
ip route add 10.0.0.0/8 dev cbr0
|
||||||
|
```
|
||||||
|
|
||||||
|
Each node should use a different address. For example:
|
||||||
|
|
||||||
|
master
|
||||||
|
|
||||||
|
```
|
||||||
|
ip addr add 10.244.0.1/24 dev cbr0
|
||||||
|
```
|
||||||
|
|
||||||
|
node1
|
||||||
|
|
||||||
|
```
|
||||||
|
ip addr add 10.244.1.1/24 dev cbr0
|
||||||
|
```
|
||||||
|
|
||||||
|
node2
|
||||||
|
|
||||||
|
```
|
||||||
|
ip addr add 10.244.2.1/24 dev cbr0
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configure IP tables
|
||||||
|
|
||||||
|
On each node run the following command to allow containers to reach the internet.
|
||||||
|
|
||||||
|
```
|
||||||
|
iptables -t nat -A POSTROUTING -o ens33 -j MASQUERADE \! -d 10.0.0.0/8
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user