From bbcce513272d532e9c5c29782fcdc4ee614d1c8d Mon Sep 17 00:00:00 2001 From: Kelsey Hightower Date: Fri, 3 Oct 2014 15:22:57 -0700 Subject: [PATCH] add coreos setup guides --- docs/getting-started-guides/coreos.md | 7 +- .../coreos/configs/master.yml | 217 ++++++++++++++++++ .../coreos/configs/node1.yml | 143 ++++++++++++ .../coreos/configs/node2.yml | 143 ++++++++++++ .../coreos/configs/standalone.yml | 134 +++++++++++ .../coreos/coreos_cloud_config.md | 75 ++++++ .../coreos/coreos_quick_start.md | 57 +++++ .../coreos/units/apiserver.service | 17 ++ .../coreos/units/controller-manager.service | 15 ++ .../coreos/units/docker.service | 11 + .../coreos/units/download-kubernetes.service | 23 ++ .../coreos/units/kubelet.service | 17 ++ .../coreos/units/proxy.service | 12 + .../coreos/units/scheduler.service | 16 ++ 14 files changed, 883 insertions(+), 4 deletions(-) create mode 100644 docs/getting-started-guides/coreos/configs/master.yml create mode 100644 docs/getting-started-guides/coreos/configs/node1.yml create mode 100644 docs/getting-started-guides/coreos/configs/node2.yml create mode 100644 docs/getting-started-guides/coreos/configs/standalone.yml create mode 100644 docs/getting-started-guides/coreos/coreos_cloud_config.md create mode 100644 docs/getting-started-guides/coreos/coreos_quick_start.md create mode 100644 docs/getting-started-guides/coreos/units/apiserver.service create mode 100644 docs/getting-started-guides/coreos/units/controller-manager.service create mode 100644 docs/getting-started-guides/coreos/units/docker.service create mode 100644 docs/getting-started-guides/coreos/units/download-kubernetes.service create mode 100644 docs/getting-started-guides/coreos/units/kubelet.service create mode 100644 docs/getting-started-guides/coreos/units/proxy.service create mode 100644 docs/getting-started-guides/coreos/units/scheduler.service diff --git a/docs/getting-started-guides/coreos.md b/docs/getting-started-guides/coreos.md index 8dd4708bdf0..df60197e591 100644 --- a/docs/getting-started-guides/coreos.md +++ b/docs/getting-started-guides/coreos.md @@ -2,10 +2,9 @@ There are multiple guides on running Kubernetes with [CoreOS](http://coreos.com): -[Single Kubernetes example in any environment](https://github.com/kelseyhightower/kubernetes-coreos) - - -[CoreOS + Fleet (work in progress)](https://github.com/kelseyhightower/kubernetes-fleet-tutorial) +* [Single Node Kubernetes example in any environment](coreos/coreos_quick_start.md) +* [Multi-node cluster using cloud-config](coreos/coreos_cloud_config.md) +* [Elastic Kubernetes cluster with fleet and flannel](https://github.com/kelseyhightower/kubernetes-fleet-tutorial) Warning: the following instructions are slightly stale, after setting this up, you need to also start the scheduler binary. diff --git a/docs/getting-started-guides/coreos/configs/master.yml b/docs/getting-started-guides/coreos/configs/master.yml new file mode 100644 index 00000000000..5ed8c6dd5cf --- /dev/null +++ b/docs/getting-started-guides/coreos/configs/master.yml @@ -0,0 +1,217 @@ +#cloud-config + +hostname: master +coreos: + etcd: + name: master + addr: 192.168.12.10:4001 + bind-addr: 0.0.0.0 + peer-addr: 192.168.12.10:7001 + peer-heartbeat-interval: 250 + peer-election-timeout: 1000 + units: + - name: static.network + command: start + content: | + [Match] + Name=ens33 + + [Network] + Address=192.168.12.10/24 + DNS=192.168.12.2 + Gateway=192.168.12.2 + - name: cbr0.netdev + command: start + content: | + [NetDev] + Kind=bridge + Name=cbr0 + - name: cbr0.network + command: start + content: | + [Match] + Name=cbr0 + + [Network] + Address=10.244.0.1/24 + + [Route] + Destination=10.0.0.0/8 + Gateway=0.0.0.0 + - name: cbr0-interface.network + command: start + content: | + [Match] + Name=ens34 + + [Network] + Bridge=cbr0 + - name: nat.service + command: start + content: | + [Unit] + Description=NAT non container traffic + + [Service] + ExecStart=/usr/sbin/iptables -t nat -A POSTROUTING -o ens33 -j MASQUERADE ! -d 10.0.0.0/8 + RemainAfterExit=yes + Type=oneshot + - name: etcd.service + command: start + - name: fleet.service + command: start + - name: docker.service + command: start + content: | + [Unit] + After=network.target + Description=Docker Application Container Engine + Documentation=http://docs.docker.io + + [Service] + ExecStartPre=/bin/mount --make-rprivate / + ExecStart=/usr/bin/docker -d -s=btrfs -H fd:// -b cbr0 --iptables=false + + [Install] + WantedBy=multi-user.target + - name: download-kubernetes.service + command: start + content: | + [Unit] + After=network-online.target + Before=apiserver.service + Before=controller-manager.service + Before=kubelet.service + Before=proxy.service + Description=Download Kubernetes Binaries + Documentation=https://github.com/GoogleCloudPlatform/kubernetes + Requires=network-online.target + + [Service] + ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/apiserver + ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/controller-manager + ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/kubecfg + ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/kubelet + ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/proxy + ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/scheduler + ExecStart=/usr/bin/chmod +x /opt/bin/apiserver + ExecStart=/usr/bin/chmod +x /opt/bin/controller-manager + ExecStart=/usr/bin/chmod +x /opt/bin/kubecfg + ExecStart=/usr/bin/chmod +x /opt/bin/kubelet + ExecStart=/usr/bin/chmod +x /opt/bin/proxy + ExecStart=/usr/bin/chmod +x /opt/bin/scheduler + RemainAfterExit=yes + Type=oneshot + - name: apiserver.service + command: start + content: | + [Unit] + After=etcd.service + After=download-kubernetes.service + ConditionFileIsExecutable=/opt/bin/apiserver + Description=Kubernetes API Server + Documentation=https://github.com/GoogleCloudPlatform/kubernetes + Wants=etcd.service + Wants=download-kubernetes.service + + [Service] + ExecStart=/opt/bin/apiserver \ + --address=127.0.0.1 \ + --port=8080 \ + --etcd_servers=http://127.0.0.1:4001 \ + --machines=192.168.12.10,192.168.12.11,192.168.12.12 \ + --logtostderr=true + Restart=always + RestartSec=10 + + [Install] + WantedBy=multi-user.target + - name: scheduler.service + command: start + content: | + [Unit] + After=apiserver.service + After=download-kubernetes.service + ConditionFileIsExecutable=/opt/bin/scheduler + Description=Kubernetes Scheduler + Documentation=https://github.com/GoogleCloudPlatform/kubernetes + Wants=apiserver.service + + [Service] + ExecStart=/opt/bin/scheduler \ + --logtostderr=true \ + --master=127.0.0.1:8080 + Restart=always + RestartSec=10 + + [Install] + WantedBy=multi-user.target + - name: controller-manager.service + command: start + content: | + [Unit] + After=etcd.service + After=download-kubernetes.service + ConditionFileIsExecutable=/opt/bin/controller-manager + Description=Kubernetes Controller Manager + Documentation=https://github.com/GoogleCloudPlatform/kubernetes + Wants=etcd.service + Wants=download-kubernetes.service + + [Service] + ExecStart=/opt/bin/controller-manager \ + --master=127.0.0.1:8080 \ + --logtostderr=true + Restart=always + RestartSec=10 + + [Install] + WantedBy=multi-user.target + - name: kubelet.service + command: start + content: | + [Unit] + After=etcd.service + After=download-kubernetes.service + ConditionFileIsExecutable=/opt/bin/kubelet + Description=Kubernetes Kubelet + Documentation=https://github.com/GoogleCloudPlatform/kubernetes + Wants=etcd.service + Wants=download-kubernetes.service + + [Service] + ExecStart=/opt/bin/kubelet \ + --address=0.0.0.0 \ + --port=10250 \ + --hostname_override=192.168.12.10 \ + --etcd_servers=http://127.0.0.1:4001 \ + --logtostderr=true + Restart=always + RestartSec=10 + + [Install] + WantedBy=multi-user.target + - name: proxy.service + command: start + content: | + [Unit] + After=etcd.service + After=download-kubernetes.service + ConditionFileIsExecutable=/opt/bin/proxy + Description=Kubernetes Proxy + Documentation=https://github.com/GoogleCloudPlatform/kubernetes + Wants=etcd.service + Wants=download-kubernetes.service + + [Service] + ExecStart=/opt/bin/proxy --etcd_servers=http://127.0.0.1:4001 --logtostderr=true + Restart=always + RestartSec=10 + + [Install] + WantedBy=multi-user.target + update: + group: alpha + reboot-strategy: off +ssh_authorized_keys: + - diff --git a/docs/getting-started-guides/coreos/configs/node1.yml b/docs/getting-started-guides/coreos/configs/node1.yml new file mode 100644 index 00000000000..4f63d1a2533 --- /dev/null +++ b/docs/getting-started-guides/coreos/configs/node1.yml @@ -0,0 +1,143 @@ +#cloud-config + +hostname: node1 +coreos: + etcd: + name: node1 + addr: 192.168.12.11:4001 + bind-addr: 0.0.0.0 + peer-addr: 192.168.12.11:7001 + peers: 192.168.12.10:7001,192.168.12.12:7001 + peer-heartbeat-interval: 250 + peer-election-timeout: 1000 + units: + - name: static.network + command: start + content: | + [Match] + Name=ens33 + + [Network] + Address=192.168.12.11/24 + DNS=192.168.12.2 + Gateway=192.168.12.2 + - name: cbr0.netdev + command: start + content: | + [NetDev] + Kind=bridge + Name=cbr0 + - name: cbr0.network + command: start + content: | + [Match] + Name=cbr0 + + [Network] + Address=10.244.1.1/24 + + [Route] + Destination=10.0.0.0/8 + Gateway=0.0.0.0 + - name: cbr0-interface.network + command: start + content: | + [Match] + Name=ens34 + + [Network] + Bridge=cbr0 + - name: nat.service + command: start + content: | + [Unit] + Description=NAT non container traffic + + [Service] + ExecStart=/usr/sbin/iptables -t nat -A POSTROUTING -o ens33 -j MASQUERADE ! -d 10.0.0.0/8 + RemainAfterExit=yes + Type=oneshot + - name: etcd.service + command: start + - name: fleet.service + command: start + - name: docker.service + command: start + content: | + [Unit] + After=network.target + Description=Docker Application Container Engine + Documentation=http://docs.docker.io + + [Service] + ExecStartPre=/bin/mount --make-rprivate / + ExecStart=/usr/bin/docker -d -s=btrfs -H fd:// -b cbr0 --iptables=false + + [Install] + WantedBy=multi-user.target + - name: download-kubernetes.service + command: start + content: | + [Unit] + After=network-online.target + Before=kubelet.service + Before=proxy.service + Description=Download Kubernetes Binaries + Documentation=https://github.com/GoogleCloudPlatform/kubernetes + Requires=network-online.target + + [Service] + ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/kubelet + ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/proxy + ExecStart=/usr/bin/chmod +x /opt/bin/kubelet + ExecStart=/usr/bin/chmod +x /opt/bin/proxy + RemainAfterExit=yes + Type=oneshot + - name: kubelet.service + command: start + content: | + [Unit] + After=etcd.service + After=download-kubernetes.service + ConditionFileIsExecutable=/opt/bin/kubelet + Description=Kubernetes Kubelet + Documentation=https://github.com/GoogleCloudPlatform/kubernetes + Wants=etcd.service + Wants=download-kubernetes.service + + [Service] + ExecStart=/opt/bin/kubelet \ + --address=0.0.0.0 \ + --port=10250 \ + --hostname_override=192.168.12.11 \ + --etcd_servers=http://127.0.0.1:4001 \ + --logtostderr=true + Restart=always + RestartSec=10 + + [Install] + WantedBy=multi-user.target + - name: proxy.service + command: start + content: | + [Unit] + After=etcd.service + After=download-kubernetes.service + ConditionFileIsExecutable=/opt/bin/proxy + Description=Kubernetes Proxy + Documentation=https://github.com/GoogleCloudPlatform/kubernetes + Wants=etcd.service + Wants=download-kubernetes.service + + [Service] + ExecStart=/opt/bin/proxy --etcd_servers=http://127.0.0.1:4001 --logtostderr=true + Restart=always + RestartSec=10 + + [Install] + WantedBy=multi-user.target + update: + group: alpha + reboot-strategy: off +ssh_authorized_keys: + - diff --git a/docs/getting-started-guides/coreos/configs/node2.yml b/docs/getting-started-guides/coreos/configs/node2.yml new file mode 100644 index 00000000000..b5a9e558280 --- /dev/null +++ b/docs/getting-started-guides/coreos/configs/node2.yml @@ -0,0 +1,143 @@ +#cloud-config + +hostname: node2 +coreos: + etcd: + name: node2 + addr: 192.168.12.12:4001 + bind-addr: 0.0.0.0 + peer-addr: 192.168.12.12:7001 + peers: 192.168.12.10:7001,192.168.12.11:7001 + peer-heartbeat-interval: 250 + peer-election-timeout: 1000 + units: + - name: static.network + command: start + content: | + [Match] + Name=ens33 + + [Network] + Address=192.168.12.12/24 + DNS=192.168.12.2 + Gateway=192.168.12.2 + - name: cbr0.netdev + command: start + content: | + [NetDev] + Kind=bridge + Name=cbr0 + - name: cbr0.network + command: start + content: | + [Match] + Name=cbr0 + + [Network] + Address=10.244.2.1/24 + + [Route] + Destination=10.0.0.0/8 + Gateway=0.0.0.0 + - name: cbr0-interface.network + command: start + content: | + [Match] + Name=ens34 + + [Network] + Bridge=cbr0 + - name: nat.service + command: start + content: | + [Unit] + Description=NAT non container traffic + + [Service] + ExecStart=/usr/sbin/iptables -t nat -A POSTROUTING -o ens33 -j MASQUERADE ! -d 10.0.0.0/8 + RemainAfterExit=yes + Type=oneshot + - name: etcd.service + command: start + - name: fleet.service + command: start + - name: docker.service + command: start + content: | + [Unit] + After=network.target + Description=Docker Application Container Engine + Documentation=http://docs.docker.io + + [Service] + ExecStartPre=/bin/mount --make-rprivate / + ExecStart=/usr/bin/docker -d -s=btrfs -H fd:// -b cbr0 --iptables=false + + [Install] + WantedBy=multi-user.target + - name: download-kubernetes.service + command: start + content: | + [Unit] + After=network-online.target + Before=kubelet.service + Before=proxy.service + Description=Download Kubernetes Binaries + Documentation=https://github.com/GoogleCloudPlatform/kubernetes + Requires=network-online.target + + [Service] + ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/kubelet + ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/proxy + ExecStart=/usr/bin/chmod +x /opt/bin/kubelet + ExecStart=/usr/bin/chmod +x /opt/bin/proxy + RemainAfterExit=yes + Type=oneshot + - name: kubelet.service + command: start + content: | + [Unit] + After=etcd.service + After=download-kubernetes.service + ConditionFileIsExecutable=/opt/bin/kubelet + Description=Kubernetes Kubelet + Documentation=https://github.com/GoogleCloudPlatform/kubernetes + Wants=etcd.service + Wants=download-kubernetes.service + + [Service] + ExecStart=/opt/bin/kubelet \ + --address=0.0.0.0 \ + --port=10250 \ + --hostname_override=192.168.12.12 \ + --etcd_servers=http://127.0.0.1:4001 \ + --logtostderr=true + Restart=always + RestartSec=10 + + [Install] + WantedBy=multi-user.target + - name: proxy.service + command: start + content: | + [Unit] + After=etcd.service + After=download-kubernetes.service + ConditionFileIsExecutable=/opt/bin/proxy + Description=Kubernetes Proxy + Documentation=https://github.com/GoogleCloudPlatform/kubernetes + Wants=etcd.service + Wants=download-kubernetes.service + + [Service] + ExecStart=/opt/bin/proxy --etcd_servers=http://127.0.0.1:4001 --logtostderr=true + Restart=always + RestartSec=10 + + [Install] + WantedBy=multi-user.target + update: + group: alpha + reboot-strategy: off +ssh_authorized_keys: + - diff --git a/docs/getting-started-guides/coreos/configs/standalone.yml b/docs/getting-started-guides/coreos/configs/standalone.yml new file mode 100644 index 00000000000..ac7fe2ccea5 --- /dev/null +++ b/docs/getting-started-guides/coreos/configs/standalone.yml @@ -0,0 +1,134 @@ +#cloud-config + +hostname: standalone +coreos: + units: + - name: etcd.service + command: start + - name: fleet.service + command: start + - name: download-kubernetes.service + command: start + content: | + [Unit] + After=network-online.target + Before=apiserver.service + Before=controller-manager.service + Before=kubelet.service + Before=proxy.service + Description=Download Kubernetes Binaries + Documentation=https://github.com/GoogleCloudPlatform/kubernetes + Requires=network-online.target + + [Service] + ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/apiserver + ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/controller-manager + ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/kubecfg + ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/kubelet + ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/proxy + ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/scheduler + ExecStart=/usr/bin/chmod +x /opt/bin/apiserver + ExecStart=/usr/bin/chmod +x /opt/bin/controller-manager + ExecStart=/usr/bin/chmod +x /opt/bin/kubecfg + ExecStart=/usr/bin/chmod +x /opt/bin/kubelet + ExecStart=/usr/bin/chmod +x /opt/bin/proxy + ExecStart=/usr/bin/chmod +x /opt/bin/scheduler + RemainAfterExit=yes + Type=oneshot + - name: apiserver.service + command: start + content: | + [Unit] + ConditionFileIsExecutable=/opt/bin/apiserver + Description=Kubernetes API Server + Documentation=https://github.com/GoogleCloudPlatform/kubernetes + + [Service] + ExecStart=/opt/bin/apiserver \ + --address=127.0.0.1 \ + --port=8080 \ + --etcd_servers=http://127.0.0.1:4001 \ + --machines=127.0.0.1 \ + --logtostderr=true + Restart=on-failure + RestartSec=1 + + [Install] + WantedBy=multi-user.target + - name: scheduler.service + command: start + content: | + [Unit] + After=apiserver.service + After=download-kubernetes.service + ConditionFileIsExecutable=/opt/bin/scheduler + Description=Kubernetes Scheduler + Documentation=https://github.com/GoogleCloudPlatform/kubernetes + Wants=apiserver.service + + [Service] + ExecStart=/opt/bin/scheduler \ + --logtostderr=true \ + --master=127.0.0.1:8080 + Restart=always + RestartSec=10 + + [Install] + WantedBy=multi-user.target + - name: controller-manager.service + command: start + content: | + [Unit] + ConditionFileIsExecutable=/opt/bin/controller-manager + Description=Kubernetes Controller Manager + Documentation=https://github.com/GoogleCloudPlatform/kubernetes + + [Service] + ExecStart=/opt/bin/controller-manager \ + --master=127.0.0.1:8080 \ + --logtostderr=true + Restart=on-failure + RestartSec=1 + + [Install] + WantedBy=multi-user.target + - name: kubelet.service + command: start + content: | + [Unit] + ConditionFileIsExecutable=/opt/bin/kubelet + Description=Kubernetes Kubelet + Documentation=https://github.com/GoogleCloudPlatform/kubernetes + + [Service] + ExecStart=/opt/bin/kubelet \ + --address=127.0.0.1 \ + --port=10250 \ + --hostname_override=127.0.0.1 \ + --etcd_servers=http://127.0.0.1:4001 \ + --logtostderr=true + Restart=on-failure + RestartSec=1 + + [Install] + WantedBy=multi-user.target + - name: proxy.service + command: start + content: | + [Unit] + ConditionFileIsExecutable=/opt/bin/proxy + Description=Kubernetes Proxy + Documentation=https://github.com/GoogleCloudPlatform/kubernetes + + [Service] + ExecStart=/opt/bin/proxy --etcd_servers=http://127.0.0.1:4001 --logtostderr=true + Restart=on-failure + RestartSec=1 + + [Install] + WantedBy=multi-user.target + update: + group: alpha + reboot-strategy: etcd-lock +ssh_authorized_keys: + - diff --git a/docs/getting-started-guides/coreos/coreos_cloud_config.md b/docs/getting-started-guides/coreos/coreos_cloud_config.md new file mode 100644 index 00000000000..5e360aacdf4 --- /dev/null +++ b/docs/getting-started-guides/coreos/coreos_cloud_config.md @@ -0,0 +1,75 @@ +# CoreOS Cloud Configs + +The recommended way to run Kubernetes on CoreOS is to use [Cloud-Config](https://coreos.com/docs/cluster-management/setup/cloudinit-cloud-config/). + +## Setup + +### Standalone + +The standalone cloud-config file can be used to setup a single node Kubernetes cluster. + +* [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 +cd kubernetes/docs/getting-started-guides/coreos/configs +``` + +Using Linux: +``` +for i in standalone master node1 node2; do + cp ${i}.yml /tmp/new-drive/openstack/latest/user_data + mkisofs -R -V config-2 -o ~/iso/${i}.iso /tmp/new-drive +done +``` + +Using OS X: +``` +for i in standalone master node1 node2; do + cp ${i}.yml /tmp/new-drive/openstack/latest/user_data + hdiutil makehybrid -iso -joliet -joliet-volume-name "config-2" -joliet -o ~/iso/${i}.iso /tmp/new-drive +done +``` + + +## Remote Access + +Setup a SSH tunnel to the Kubernetes API Server. + +``` +sudo ssh -f -nNT -L 8080:127.0.0.1:8080 core@${APISERVER} +``` + +Download a kubecfg client + +**Darwin** + +``` +wget http://storage.googleapis.com/kubernetes/darwin/kubecfg -O /usr/local/bin/kubecfg +``` + +**Linux** + +``` +wget http://storage.googleapis.com/kubernetes/kubecfg -O /usr/local/bin/kubecfg +``` + +Issue commands remotely using the kubecfg command line tool. + +``` +kubecfg list /pods +``` diff --git a/docs/getting-started-guides/coreos/coreos_quick_start.md b/docs/getting-started-guides/coreos/coreos_quick_start.md new file mode 100644 index 00000000000..71e4da30d6e --- /dev/null +++ b/docs/getting-started-guides/coreos/coreos_quick_start.md @@ -0,0 +1,57 @@ +# 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). + +### Install Kubernetes binaries + +``` +sudo mkdir -p /opt/bin +sudo wget https://storage.googleapis.com/kubernetes/binaries.tar.gz +sudo tar -xvf binaries.tar.gz -C /opt/bin +``` + +### Add the Kubernetes systemd units + +``` +git clone https://github.com/GoogleCloudPlatform/kubernetes.git +sudo cp kubernetes/docs/getting-started-guides/coreos/units/* /etc/systemd/system/ +``` + +### Start the Kubernetes services + +``` +sudo systemctl start apiserver +sudo systemctl start scheduler +sudo systemctl start controller-manager +sudo systemctl start kubelet +sudo systemctl start proxy +``` + +### Running commands remotely + +Setup a SSH tunnel to the Kubernetes API Server. + +``` +sudo ssh -f -nNT -L 8080:127.0.0.1:8080 core@${APISERVER} +``` + +Download a kubecfg client + +**Darwin** + +``` +curl -o /usr/local/bin/kubecfg https://storage.googleapis.com/kubernetes/darwin/kubecfg +chmod +x /usr/local/bin/kubecfg +``` + +**Linux** + +``` +wget https://storage.googleapis.com/kubernetes/kubecfg -O /usr/local/bin/kubecfg +``` + +Issue commands remotely using the kubecfg command line tool. + +``` +kubecfg list /pods +``` diff --git a/docs/getting-started-guides/coreos/units/apiserver.service b/docs/getting-started-guides/coreos/units/apiserver.service new file mode 100644 index 00000000000..034c94a0b48 --- /dev/null +++ b/docs/getting-started-guides/coreos/units/apiserver.service @@ -0,0 +1,17 @@ +[Unit] +ConditionFileIsExecutable=/opt/bin/apiserver +Description=Kubernetes API Server +Documentation=https://github.com/GoogleCloudPlatform/kubernetes + +[Service] +ExecStart=/opt/bin/apiserver \ +--address=127.0.0.1 \ +--port=8080 \ +--etcd_servers=http://127.0.0.1:4001 \ +--machines=127.0.0.1 \ +--logtostderr=true +Restart=on-failure +RestartSec=1 + +[Install] +WantedBy=multi-user.target diff --git a/docs/getting-started-guides/coreos/units/controller-manager.service b/docs/getting-started-guides/coreos/units/controller-manager.service new file mode 100644 index 00000000000..25f0fb82b56 --- /dev/null +++ b/docs/getting-started-guides/coreos/units/controller-manager.service @@ -0,0 +1,15 @@ +[Unit] +ConditionFileIsExecutable=/opt/bin/controller-manager +Description=Kubernetes Controller Manager +Documentation=https://github.com/GoogleCloudPlatform/kubernetes + +[Service] +ExecStart=/opt/bin/controller-manager \ +--master=127.0.0.1:8080 \ +--etcd_servers=http://127.0.0.1:4001 \ +--logtostderr=true +Restart=on-failure +RestartSec=1 + +[Install] +WantedBy=multi-user.target diff --git a/docs/getting-started-guides/coreos/units/docker.service b/docs/getting-started-guides/coreos/units/docker.service new file mode 100644 index 00000000000..2a2f8147f8c --- /dev/null +++ b/docs/getting-started-guides/coreos/units/docker.service @@ -0,0 +1,11 @@ +[Unit] +After=network.target +Description=Docker Application Container Engine +Documentation=http://docs.docker.io + +[Service] +ExecStartPre=/bin/mount --make-rprivate / +ExecStart=/usr/bin/docker -d -s=btrfs -H fd:// -b cbr0 --iptables=false + +[Install] +WantedBy=multi-user.target diff --git a/docs/getting-started-guides/coreos/units/download-kubernetes.service b/docs/getting-started-guides/coreos/units/download-kubernetes.service new file mode 100644 index 00000000000..2b0fbeac722 --- /dev/null +++ b/docs/getting-started-guides/coreos/units/download-kubernetes.service @@ -0,0 +1,23 @@ +[Unit] +After=network-online.target +Before=apiserver.service +Before=controller-manager.service +Before=kubelet.service +Before=proxy.service +Description=Download Kubernetes Binaries +Documentation=https://github.com/GoogleCloudPlatform/kubernetes +Requires=network-online.target + +[Service] +ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/apiserver +ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/controller-manager +ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/kubecfg +ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/kubelet +ExecStart=/usr/bin/wget -N -P /opt/bin http://storage.googleapis.com/kubernetes/proxy +ExecStart=/usr/bin/chmod +x /opt/bin/apiserver +ExecStart=/usr/bin/chmod +x /opt/bin/controller-manager +ExecStart=/usr/bin/chmod +x /opt/bin/kubecfg +ExecStart=/usr/bin/chmod +x /opt/bin/kubelet +ExecStart=/usr/bin/chmod +x /opt/bin/proxy +RemainAfterExit=yes +Type=oneshot diff --git a/docs/getting-started-guides/coreos/units/kubelet.service b/docs/getting-started-guides/coreos/units/kubelet.service new file mode 100644 index 00000000000..1f0da43ecd6 --- /dev/null +++ b/docs/getting-started-guides/coreos/units/kubelet.service @@ -0,0 +1,17 @@ +[Unit] +ConditionFileIsExecutable=/opt/bin/kubelet +Description=Kubernetes Kubelet +Documentation=https://github.com/GoogleCloudPlatform/kubernetes + +[Service] +ExecStart=/opt/bin/kubelet \ +--address=127.0.0.1 \ +--port=10250 \ +--hostname_override=127.0.0.1 \ +--etcd_servers=http://127.0.0.1:4001 \ +--logtostderr=true +Restart=on-failure +RestartSec=1 + +[Install] +WantedBy=multi-user.target diff --git a/docs/getting-started-guides/coreos/units/proxy.service b/docs/getting-started-guides/coreos/units/proxy.service new file mode 100644 index 00000000000..c109c846b93 --- /dev/null +++ b/docs/getting-started-guides/coreos/units/proxy.service @@ -0,0 +1,12 @@ +[Unit] +ConditionFileIsExecutable=/opt/bin/proxy +Description=Kubernetes Proxy +Documentation=https://github.com/GoogleCloudPlatform/kubernetes + +[Service] +ExecStart=/opt/bin/proxy --etcd_servers=http://127.0.0.1:4001 --logtostderr=true +Restart=on-failure +RestartSec=1 + +[Install] +WantedBy=multi-user.target diff --git a/docs/getting-started-guides/coreos/units/scheduler.service b/docs/getting-started-guides/coreos/units/scheduler.service new file mode 100644 index 00000000000..603cb9a4681 --- /dev/null +++ b/docs/getting-started-guides/coreos/units/scheduler.service @@ -0,0 +1,16 @@ +[Unit] +After=apiserver.service +ConditionFileIsExecutable=/opt/bin/scheduler +Description=Kubernetes Scheduler +Documentation=https://github.com/GoogleCloudPlatform/kubernetes +Wants=apiserver.service + +[Service] +ExecStart=/opt/bin/scheduler \ +--logtostderr=true \ +--master=127.0.0.1:8080 +Restart=always +RestartSec=10 + +[Install] +WantedBy=multi-user.target