mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 03:11:40 +00:00
Merge pull request #26031 from luxas/remove_docker_multinode
Remove docker-multinode
This commit is contained in:
commit
5bc7ec7a48
@ -32,7 +32,7 @@ Documentation for other releases can be found at
|
|||||||
|
|
||||||
<!-- END MUNGE: UNVERSIONED_WARNING -->
|
<!-- END MUNGE: UNVERSIONED_WARNING -->
|
||||||
|
|
||||||
This file has moved to: http://kubernetes.github.io/docs/getting-started-guides/docker-multinode/
|
This deployment has moved to: https://github.com/kubernetes/kube-deploy
|
||||||
|
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->
|
|
||||||
|
|
||||||
<!-- BEGIN STRIP_FOR_RELEASE -->
|
|
||||||
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
|
|
||||||
<h2>PLEASE NOTE: This document applies to the HEAD of the source tree</h2>
|
|
||||||
|
|
||||||
If you are using a released version of Kubernetes, you should
|
|
||||||
refer to the docs that go with that version.
|
|
||||||
|
|
||||||
<!-- TAG RELEASE_LINK, added by the munger automatically -->
|
|
||||||
<strong>
|
|
||||||
The latest release of this document can be found
|
|
||||||
[here](http://releases.k8s.io/release-1.2/docs/getting-started-guides/docker-multinode/deployDNS.md).
|
|
||||||
|
|
||||||
Documentation for other releases can be found at
|
|
||||||
[releases.k8s.io](http://releases.k8s.io).
|
|
||||||
</strong>
|
|
||||||
--
|
|
||||||
|
|
||||||
<!-- END STRIP_FOR_RELEASE -->
|
|
||||||
|
|
||||||
<!-- END MUNGE: UNVERSIONED_WARNING -->
|
|
||||||
|
|
||||||
This file has moved to: http://kubernetes.github.io/docs/getting-started-guides/docker-multinode/deployDNS/
|
|
||||||
|
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
|
||||||
[]()
|
|
||||||
<!-- END MUNGE: GENERATED_ANALYTICS -->
|
|
@ -1,4 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Namespace
|
|
||||||
metadata:
|
|
||||||
name: kube-system
|
|
@ -1,40 +0,0 @@
|
|||||||
<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->
|
|
||||||
|
|
||||||
<!-- BEGIN STRIP_FOR_RELEASE -->
|
|
||||||
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
|
|
||||||
<h2>PLEASE NOTE: This document applies to the HEAD of the source tree</h2>
|
|
||||||
|
|
||||||
If you are using a released version of Kubernetes, you should
|
|
||||||
refer to the docs that go with that version.
|
|
||||||
|
|
||||||
<!-- TAG RELEASE_LINK, added by the munger automatically -->
|
|
||||||
<strong>
|
|
||||||
The latest release of this document can be found
|
|
||||||
[here](http://releases.k8s.io/release-1.2/docs/getting-started-guides/docker-multinode/master.md).
|
|
||||||
|
|
||||||
Documentation for other releases can be found at
|
|
||||||
[releases.k8s.io](http://releases.k8s.io).
|
|
||||||
</strong>
|
|
||||||
--
|
|
||||||
|
|
||||||
<!-- END STRIP_FOR_RELEASE -->
|
|
||||||
|
|
||||||
<!-- END MUNGE: UNVERSIONED_WARNING -->
|
|
||||||
|
|
||||||
This file has moved to: http://kubernetes.github.io/docs/getting-started-guides/docker-multinode/master/
|
|
||||||
|
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
|
||||||
[]()
|
|
||||||
<!-- END MUNGE: GENERATED_ANALYTICS -->
|
|
@ -1,243 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Copyright 2015 The Kubernetes Authors All rights reserved.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
# A script to setup the k8s master in docker containers.
|
|
||||||
# Authors @wizard_cxy @resouer
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Make sure docker daemon is running
|
|
||||||
if ( ! ps -ef | grep "/usr/bin/docker" | grep -v 'grep' &> /dev/null ); then
|
|
||||||
echo "Docker is not running on this machine!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Make sure k8s version env is properly set
|
|
||||||
K8S_VERSION=${K8S_VERSION:-"1.2.0-alpha.7"}
|
|
||||||
ETCD_VERSION=${ETCD_VERSION:-"2.2.1"}
|
|
||||||
FLANNEL_VERSION=${FLANNEL_VERSION:-"0.5.5"}
|
|
||||||
FLANNEL_IPMASQ=${FLANNEL_IPMASQ:-"true"}
|
|
||||||
FLANNEL_IFACE=${FLANNEL_IFACE:-"eth0"}
|
|
||||||
ARCH=${ARCH:-"amd64"}
|
|
||||||
|
|
||||||
# Run as root
|
|
||||||
if [ "$(id -u)" != "0" ]; then
|
|
||||||
echo >&2 "Please run as root"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Make sure master ip is properly set
|
|
||||||
if [ -z ${MASTER_IP} ]; then
|
|
||||||
MASTER_IP=$(hostname -I | awk '{print $1}')
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "K8S_VERSION is set to: ${K8S_VERSION}"
|
|
||||||
echo "ETCD_VERSION is set to: ${ETCD_VERSION}"
|
|
||||||
echo "FLANNEL_VERSION is set to: ${FLANNEL_VERSION}"
|
|
||||||
echo "FLANNEL_IFACE is set to: ${FLANNEL_IFACE}"
|
|
||||||
echo "FLANNEL_IPMASQ is set to: ${FLANNEL_IPMASQ}"
|
|
||||||
echo "MASTER_IP is set to: ${MASTER_IP}"
|
|
||||||
echo "ARCH is set to: ${ARCH}"
|
|
||||||
|
|
||||||
# Check if a command is valid
|
|
||||||
command_exists() {
|
|
||||||
command -v "$@" > /dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
lsb_dist=""
|
|
||||||
|
|
||||||
# Detect the OS distro, we support ubuntu, debian, mint, centos, fedora dist
|
|
||||||
detect_lsb() {
|
|
||||||
# TODO: remove this when ARM support is fully merged
|
|
||||||
case "$(uname -m)" in
|
|
||||||
*64)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Error: We currently only support 64-bit platforms."
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if command_exists lsb_release; then
|
|
||||||
lsb_dist="$(lsb_release -si)"
|
|
||||||
fi
|
|
||||||
if [ -z ${lsb_dist} ] && [ -r /etc/lsb-release ]; then
|
|
||||||
lsb_dist="$(. /etc/lsb-release && echo "$DISTRIB_ID")"
|
|
||||||
fi
|
|
||||||
if [ -z ${lsb_dist} ] && [ -r /etc/debian_version ]; then
|
|
||||||
lsb_dist='debian'
|
|
||||||
fi
|
|
||||||
if [ -z ${lsb_dist} ] && [ -r /etc/fedora-release ]; then
|
|
||||||
lsb_dist='fedora'
|
|
||||||
fi
|
|
||||||
if [ -z ${lsb_dist} ] && [ -r /etc/os-release ]; then
|
|
||||||
lsb_dist="$(. /etc/os-release && echo "$ID")"
|
|
||||||
fi
|
|
||||||
|
|
||||||
lsb_dist="$(echo ${lsb_dist} | tr '[:upper:]' '[:lower:]')"
|
|
||||||
|
|
||||||
case "${lsb_dist}" in
|
|
||||||
amzn|centos|debian|ubuntu)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Error: We currently only support ubuntu|debian|amzn|centos."
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Start the bootstrap daemon
|
|
||||||
# TODO: do not start docker-bootstrap if it's already running
|
|
||||||
bootstrap_daemon() {
|
|
||||||
# Detecting docker version so we could run proper docker_daemon command
|
|
||||||
[[ $(eval "docker --version") =~ ([0-9][.][0-9][.][0-9]*) ]] && version="${BASH_REMATCH[1]}"
|
|
||||||
local got=$(echo -e "${version}\n1.8.0" | sed '/^$/d' | sort -nr | head -1)
|
|
||||||
if [[ "${got}" = "${version}" ]]; then
|
|
||||||
docker_daemon="docker -d"
|
|
||||||
else
|
|
||||||
docker_daemon="docker daemon"
|
|
||||||
fi
|
|
||||||
${docker_daemon} \
|
|
||||||
-H unix:///var/run/docker-bootstrap.sock \
|
|
||||||
-p /var/run/docker-bootstrap.pid \
|
|
||||||
--iptables=false \
|
|
||||||
--ip-masq=false \
|
|
||||||
--bridge=none \
|
|
||||||
--graph=/var/lib/docker-bootstrap \
|
|
||||||
2> /var/log/docker-bootstrap.log \
|
|
||||||
1> /dev/null &
|
|
||||||
|
|
||||||
sleep 5
|
|
||||||
}
|
|
||||||
|
|
||||||
# Start k8s components in containers
|
|
||||||
DOCKER_CONF=""
|
|
||||||
|
|
||||||
start_k8s(){
|
|
||||||
# Start etcd
|
|
||||||
docker -H unix:///var/run/docker-bootstrap.sock run \
|
|
||||||
--restart=on-failure \
|
|
||||||
--net=host \
|
|
||||||
-d \
|
|
||||||
gcr.io/google_containers/etcd-${ARCH}:${ETCD_VERSION} \
|
|
||||||
/usr/local/bin/etcd \
|
|
||||||
--listen-client-urls=http://127.0.0.1:4001,http://${MASTER_IP}:4001 \
|
|
||||||
--advertise-client-urls=http://${MASTER_IP}:4001 \
|
|
||||||
--data-dir=/var/etcd/data
|
|
||||||
|
|
||||||
sleep 5
|
|
||||||
# Set flannel net config
|
|
||||||
docker -H unix:///var/run/docker-bootstrap.sock run \
|
|
||||||
--net=host gcr.io/google_containers/etcd:${ETCD_VERSION} \
|
|
||||||
etcdctl \
|
|
||||||
set /coreos.com/network/config \
|
|
||||||
'{ "Network": "10.1.0.0/16", "Backend": {"Type": "vxlan"}}'
|
|
||||||
|
|
||||||
# iface may change to a private network interface, eth0 is for default
|
|
||||||
flannelCID=$(docker -H unix:///var/run/docker-bootstrap.sock run \
|
|
||||||
--restart=on-failure \
|
|
||||||
-d \
|
|
||||||
--net=host \
|
|
||||||
--privileged \
|
|
||||||
-v /dev/net:/dev/net \
|
|
||||||
quay.io/coreos/flannel:${FLANNEL_VERSION} \
|
|
||||||
/opt/bin/flanneld \
|
|
||||||
--ip-masq="${FLANNEL_IPMASQ}" \
|
|
||||||
--iface="${FLANNEL_IFACE}")
|
|
||||||
|
|
||||||
sleep 8
|
|
||||||
|
|
||||||
# Copy flannel env out and source it on the host
|
|
||||||
docker -H unix:///var/run/docker-bootstrap.sock \
|
|
||||||
cp ${flannelCID}:/run/flannel/subnet.env .
|
|
||||||
source subnet.env
|
|
||||||
|
|
||||||
# Configure docker net settings, then restart it
|
|
||||||
case "${lsb_dist}" in
|
|
||||||
amzn)
|
|
||||||
DOCKER_CONF="/etc/sysconfig/docker"
|
|
||||||
echo "OPTIONS=\"\$OPTIONS --mtu=${FLANNEL_MTU} --bip=${FLANNEL_SUBNET}\"" | tee -a ${DOCKER_CONF}
|
|
||||||
ifconfig docker0 down
|
|
||||||
yum -y -q install bridge-utils && brctl delbr docker0 && service docker restart
|
|
||||||
;;
|
|
||||||
centos)
|
|
||||||
DOCKER_CONF="/etc/sysconfig/docker"
|
|
||||||
echo "OPTIONS=\"\$OPTIONS --mtu=${FLANNEL_MTU} --bip=${FLANNEL_SUBNET}\"" | tee -a ${DOCKER_CONF}
|
|
||||||
if ! command_exists ifconfig; then
|
|
||||||
yum -y -q install net-tools
|
|
||||||
fi
|
|
||||||
ifconfig docker0 down
|
|
||||||
yum -y -q install bridge-utils && brctl delbr docker0 && systemctl restart docker
|
|
||||||
;;
|
|
||||||
ubuntu|debian)
|
|
||||||
DOCKER_CONF="/etc/default/docker"
|
|
||||||
echo "DOCKER_OPTS=\"\$DOCKER_OPTS --mtu=${FLANNEL_MTU} --bip=${FLANNEL_SUBNET}\"" | tee -a ${DOCKER_CONF}
|
|
||||||
ifconfig docker0 down
|
|
||||||
apt-get install bridge-utils
|
|
||||||
brctl delbr docker0
|
|
||||||
service docker stop
|
|
||||||
while [ `ps aux | grep /usr/bin/docker | grep -v grep | wc -l` -gt 0 ]; do
|
|
||||||
echo "Waiting for docker to terminate"
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
service docker start
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unsupported operations system ${lsb_dist}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# sleep a little bit
|
|
||||||
sleep 5
|
|
||||||
|
|
||||||
# Start kubelet and then start master components as pods
|
|
||||||
docker run \
|
|
||||||
--net=host \
|
|
||||||
--pid=host \
|
|
||||||
--privileged \
|
|
||||||
--restart=on-failure \
|
|
||||||
-d \
|
|
||||||
-v /sys:/sys:ro \
|
|
||||||
-v /var/run:/var/run:rw \
|
|
||||||
-v /:/rootfs:ro \
|
|
||||||
-v /var/lib/docker/:/var/lib/docker:rw \
|
|
||||||
-v /var/lib/kubelet/:/var/lib/kubelet:rw \
|
|
||||||
gcr.io/google_containers/hyperkube-${ARCH}:v${K8S_VERSION} \
|
|
||||||
/hyperkube kubelet \
|
|
||||||
--address=0.0.0.0 \
|
|
||||||
--allow-privileged=true \
|
|
||||||
--enable-server \
|
|
||||||
--api-servers=http://localhost:8080 \
|
|
||||||
--config=/etc/kubernetes/manifests-multi \
|
|
||||||
--cluster-dns=10.0.0.10 \
|
|
||||||
--cluster-domain=cluster.local \
|
|
||||||
--containerized \
|
|
||||||
--v=2
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "Detecting your OS distro ..."
|
|
||||||
detect_lsb
|
|
||||||
|
|
||||||
echo "Starting bootstrap docker ..."
|
|
||||||
bootstrap_daemon
|
|
||||||
|
|
||||||
echo "Starting k8s ..."
|
|
||||||
start_k8s
|
|
||||||
|
|
||||||
echo "Master done!"
|
|
@ -1,136 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: ReplicationController
|
|
||||||
metadata:
|
|
||||||
name: kube-dns-v10
|
|
||||||
namespace: kube-system
|
|
||||||
labels:
|
|
||||||
k8s-app: kube-dns
|
|
||||||
version: v10
|
|
||||||
kubernetes.io/cluster-service: "true"
|
|
||||||
spec:
|
|
||||||
replicas: {{ pillar['dns_replicas'] }}
|
|
||||||
selector:
|
|
||||||
k8s-app: kube-dns
|
|
||||||
version: v10
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
k8s-app: kube-dns
|
|
||||||
version: v10
|
|
||||||
kubernetes.io/cluster-service: "true"
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: etcd
|
|
||||||
image: gcr.io/google_containers/etcd-amd64:2.2.1
|
|
||||||
resources:
|
|
||||||
# keep request = limit to keep this container in guaranteed class
|
|
||||||
limits:
|
|
||||||
cpu: 100m
|
|
||||||
memory: 50Mi
|
|
||||||
requests:
|
|
||||||
cpu: 100m
|
|
||||||
memory: 50Mi
|
|
||||||
command:
|
|
||||||
- /usr/local/bin/etcd
|
|
||||||
- -data-dir
|
|
||||||
- /var/etcd/data
|
|
||||||
- -listen-client-urls
|
|
||||||
- http://127.0.0.1:2379,http://127.0.0.1:4001
|
|
||||||
- -advertise-client-urls
|
|
||||||
- http://127.0.0.1:2379,http://127.0.0.1:4001
|
|
||||||
- -initial-cluster-token
|
|
||||||
- skydns-etcd
|
|
||||||
volumeMounts:
|
|
||||||
- name: etcd-storage
|
|
||||||
mountPath: /var/etcd/data
|
|
||||||
- name: kube2sky
|
|
||||||
image: gcr.io/google_containers/kube2sky:1.12
|
|
||||||
resources:
|
|
||||||
# keep request = limit to keep this container in guaranteed class
|
|
||||||
limits:
|
|
||||||
cpu: 100m
|
|
||||||
memory: 50Mi
|
|
||||||
requests:
|
|
||||||
cpu: 100m
|
|
||||||
memory: 50Mi
|
|
||||||
args:
|
|
||||||
# command = "/kube2sky"
|
|
||||||
- --domain={{ pillar['dns_domain'] }}
|
|
||||||
- name: skydns
|
|
||||||
image: gcr.io/google_containers/skydns:2015-10-13-8c72f8c
|
|
||||||
resources:
|
|
||||||
# keep request = limit to keep this container in guaranteed class
|
|
||||||
limits:
|
|
||||||
cpu: 100m
|
|
||||||
memory: 50Mi
|
|
||||||
requests:
|
|
||||||
cpu: 100m
|
|
||||||
memory: 50Mi
|
|
||||||
args:
|
|
||||||
# command = "/skydns"
|
|
||||||
- -machines=http://127.0.0.1:4001
|
|
||||||
- -addr=0.0.0.0:53
|
|
||||||
- -ns-rotate=false
|
|
||||||
- -domain={{ pillar['dns_domain'] }}.
|
|
||||||
ports:
|
|
||||||
- containerPort: 53
|
|
||||||
name: dns
|
|
||||||
protocol: UDP
|
|
||||||
- containerPort: 53
|
|
||||||
name: dns-tcp
|
|
||||||
protocol: TCP
|
|
||||||
livenessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /healthz
|
|
||||||
port: 8080
|
|
||||||
scheme: HTTP
|
|
||||||
initialDelaySeconds: 30
|
|
||||||
timeoutSeconds: 5
|
|
||||||
readinessProbe:
|
|
||||||
httpGet:
|
|
||||||
path: /healthz
|
|
||||||
port: 8080
|
|
||||||
scheme: HTTP
|
|
||||||
initialDelaySeconds: 1
|
|
||||||
timeoutSeconds: 5
|
|
||||||
- name: healthz
|
|
||||||
image: gcr.io/google_containers/exechealthz:1.0
|
|
||||||
resources:
|
|
||||||
# keep request = limit to keep this container in guaranteed class
|
|
||||||
limits:
|
|
||||||
cpu: 10m
|
|
||||||
memory: 20Mi
|
|
||||||
requests:
|
|
||||||
cpu: 10m
|
|
||||||
memory: 20Mi
|
|
||||||
args:
|
|
||||||
- -cmd=nslookup kubernetes.default.svc.{{ pillar['dns_domain'] }} 127.0.0.1 >/dev/null
|
|
||||||
- -port=8080
|
|
||||||
ports:
|
|
||||||
- containerPort: 8080
|
|
||||||
protocol: TCP
|
|
||||||
volumes:
|
|
||||||
- name: etcd-storage
|
|
||||||
emptyDir: {}
|
|
||||||
dnsPolicy: Default # Don't use cluster DNS.
|
|
||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: kube-dns
|
|
||||||
namespace: kube-system
|
|
||||||
labels:
|
|
||||||
k8s-app: kube-dns
|
|
||||||
kubernetes.io/cluster-service: "true"
|
|
||||||
kubernetes.io/name: "KubeDNS"
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
k8s-app: kube-dns
|
|
||||||
clusterIP: {{ pillar['dns_server'] }}
|
|
||||||
ports:
|
|
||||||
- name: dns
|
|
||||||
port: 53
|
|
||||||
protocol: UDP
|
|
||||||
- name: dns-tcp
|
|
||||||
port: 53
|
|
||||||
protocol: TCP
|
|
@ -1,40 +0,0 @@
|
|||||||
<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->
|
|
||||||
|
|
||||||
<!-- BEGIN STRIP_FOR_RELEASE -->
|
|
||||||
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
|
|
||||||
<h2>PLEASE NOTE: This document applies to the HEAD of the source tree</h2>
|
|
||||||
|
|
||||||
If you are using a released version of Kubernetes, you should
|
|
||||||
refer to the docs that go with that version.
|
|
||||||
|
|
||||||
<!-- TAG RELEASE_LINK, added by the munger automatically -->
|
|
||||||
<strong>
|
|
||||||
The latest release of this document can be found
|
|
||||||
[here](http://releases.k8s.io/release-1.2/docs/getting-started-guides/docker-multinode/testing.md).
|
|
||||||
|
|
||||||
Documentation for other releases can be found at
|
|
||||||
[releases.k8s.io](http://releases.k8s.io).
|
|
||||||
</strong>
|
|
||||||
--
|
|
||||||
|
|
||||||
<!-- END STRIP_FOR_RELEASE -->
|
|
||||||
|
|
||||||
<!-- END MUNGE: UNVERSIONED_WARNING -->
|
|
||||||
|
|
||||||
This file has moved to: http://kubernetes.github.io/docs/getting-started-guides/docker-multinode/testing/
|
|
||||||
|
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
|
||||||
[]()
|
|
||||||
<!-- END MUNGE: GENERATED_ANALYTICS -->
|
|
@ -1,40 +0,0 @@
|
|||||||
<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->
|
|
||||||
|
|
||||||
<!-- BEGIN STRIP_FOR_RELEASE -->
|
|
||||||
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
<img src="http://kubernetes.io/img/warning.png" alt="WARNING"
|
|
||||||
width="25" height="25">
|
|
||||||
|
|
||||||
<h2>PLEASE NOTE: This document applies to the HEAD of the source tree</h2>
|
|
||||||
|
|
||||||
If you are using a released version of Kubernetes, you should
|
|
||||||
refer to the docs that go with that version.
|
|
||||||
|
|
||||||
<!-- TAG RELEASE_LINK, added by the munger automatically -->
|
|
||||||
<strong>
|
|
||||||
The latest release of this document can be found
|
|
||||||
[here](http://releases.k8s.io/release-1.2/docs/getting-started-guides/docker-multinode/worker.md).
|
|
||||||
|
|
||||||
Documentation for other releases can be found at
|
|
||||||
[releases.k8s.io](http://releases.k8s.io).
|
|
||||||
</strong>
|
|
||||||
--
|
|
||||||
|
|
||||||
<!-- END STRIP_FOR_RELEASE -->
|
|
||||||
|
|
||||||
<!-- END MUNGE: UNVERSIONED_WARNING -->
|
|
||||||
|
|
||||||
This file has moved to: http://kubernetes.github.io/docs/getting-started-guides/docker-multinode/worker/
|
|
||||||
|
|
||||||
|
|
||||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
|
||||||
[]()
|
|
||||||
<!-- END MUNGE: GENERATED_ANALYTICS -->
|
|
@ -1,231 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Copyright 2015 The Kubernetes Authors All rights reserved.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
# A script to the k8s worker in docker containers.
|
|
||||||
# Authors @wizard_cxy @resouer
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Make sure docker daemon is running
|
|
||||||
if ( ! ps -ef | grep "/usr/bin/docker" | grep -v 'grep' &> /dev/null ); then
|
|
||||||
echo "Docker is not running on this machine!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Make sure k8s version env is properly set
|
|
||||||
K8S_VERSION=${K8S_VERSION:-"1.2.0-alpha.7"}
|
|
||||||
FLANNEL_VERSION=${FLANNEL_VERSION:-"0.5.5"}
|
|
||||||
FLANNEL_IFACE=${FLANNEL_IFACE:-"eth0"}
|
|
||||||
FLANNEL_IPMASQ=${FLANNEL_IPMASQ:-"true"}
|
|
||||||
ARCH=${ARCH:-"amd64"}
|
|
||||||
|
|
||||||
# Run as root
|
|
||||||
if [ "$(id -u)" != "0" ]; then
|
|
||||||
echo >&2 "Please run as root"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Make sure master ip is properly set
|
|
||||||
if [ -z ${MASTER_IP} ]; then
|
|
||||||
echo "Please export MASTER_IP in your env"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "K8S_VERSION is set to: ${K8S_VERSION}"
|
|
||||||
echo "FLANNEL_VERSION is set to: ${FLANNEL_VERSION}"
|
|
||||||
echo "FLANNEL_IFACE is set to: ${FLANNEL_IFACE}"
|
|
||||||
echo "FLANNEL_IPMASQ is set to: ${FLANNEL_IPMASQ}"
|
|
||||||
echo "MASTER_IP is set to: ${MASTER_IP}"
|
|
||||||
echo "ARCH is set to: ${ARCH}"
|
|
||||||
|
|
||||||
# Check if a command is valid
|
|
||||||
command_exists() {
|
|
||||||
command -v "$@" > /dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
lsb_dist=""
|
|
||||||
|
|
||||||
# Detect the OS distro, we support ubuntu, debian, mint, centos, fedora dist
|
|
||||||
detect_lsb() {
|
|
||||||
case "$(uname -m)" in
|
|
||||||
*64)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Error: We currently only support 64-bit platforms."
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if command_exists lsb_release; then
|
|
||||||
lsb_dist="$(lsb_release -si)"
|
|
||||||
fi
|
|
||||||
if [ -z ${lsb_dist} ] && [ -r /etc/lsb-release ]; then
|
|
||||||
lsb_dist="$(. /etc/lsb-release && echo "$DISTRIB_ID")"
|
|
||||||
fi
|
|
||||||
if [ -z ${lsb_dist} ] && [ -r /etc/debian_version ]; then
|
|
||||||
lsb_dist='debian'
|
|
||||||
fi
|
|
||||||
if [ -z ${lsb_dist} ] && [ -r /etc/fedora-release ]; then
|
|
||||||
lsb_dist='fedora'
|
|
||||||
fi
|
|
||||||
if [ -z ${lsb_dist} ] && [ -r /etc/os-release ]; then
|
|
||||||
lsb_dist="$(. /etc/os-release && echo "$ID")"
|
|
||||||
fi
|
|
||||||
|
|
||||||
lsb_dist="$(echo ${lsb_dist} | tr '[:upper:]' '[:lower:]')"
|
|
||||||
|
|
||||||
case "${lsb_dist}" in
|
|
||||||
amzn|centos|debian|ubuntu)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Error: We currently only support ubuntu|debian|amzn|centos."
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Start the bootstrap daemon
|
|
||||||
bootstrap_daemon() {
|
|
||||||
# Detecting docker version so we could run proper docker_daemon command
|
|
||||||
[[ $(eval "docker --version") =~ ([0-9][.][0-9][.][0-9]*) ]] && version="${BASH_REMATCH[1]}"
|
|
||||||
local got=$(echo -e "${version}\n1.8.0" | sed '/^$/d' | sort -nr | head -1)
|
|
||||||
if [[ "${got}" = "${version}" ]]; then
|
|
||||||
docker_daemon="docker -d"
|
|
||||||
else
|
|
||||||
docker_daemon="docker daemon"
|
|
||||||
fi
|
|
||||||
${docker_daemon} \
|
|
||||||
-H unix:///var/run/docker-bootstrap.sock \
|
|
||||||
-p /var/run/docker-bootstrap.pid \
|
|
||||||
--iptables=false \
|
|
||||||
--ip-masq=false \
|
|
||||||
--bridge=none \
|
|
||||||
--graph=/var/lib/docker-bootstrap \
|
|
||||||
2> /var/log/docker-bootstrap.log \
|
|
||||||
1> /dev/null &
|
|
||||||
|
|
||||||
sleep 5
|
|
||||||
}
|
|
||||||
|
|
||||||
DOCKER_CONF=""
|
|
||||||
|
|
||||||
# Start k8s components in containers
|
|
||||||
start_k8s() {
|
|
||||||
# Start flannel
|
|
||||||
flannelCID=$(docker -H unix:///var/run/docker-bootstrap.sock run \
|
|
||||||
-d \
|
|
||||||
--restart=on-failure \
|
|
||||||
--net=host \
|
|
||||||
--privileged \
|
|
||||||
-v /dev/net:/dev/net \
|
|
||||||
quay.io/coreos/flannel:${FLANNEL_VERSION} \
|
|
||||||
/opt/bin/flanneld \
|
|
||||||
--ip-masq="${FLANNEL_IPMASQ}" \
|
|
||||||
--etcd-endpoints=http://${MASTER_IP}:4001 \
|
|
||||||
--iface="${FLANNEL_IFACE}")
|
|
||||||
|
|
||||||
sleep 10
|
|
||||||
|
|
||||||
# Copy flannel env out and source it on the host
|
|
||||||
docker -H unix:///var/run/docker-bootstrap.sock \
|
|
||||||
cp ${flannelCID}:/run/flannel/subnet.env .
|
|
||||||
source subnet.env
|
|
||||||
|
|
||||||
# Configure docker net settings, then restart it
|
|
||||||
case "${lsb_dist}" in
|
|
||||||
centos)
|
|
||||||
DOCKER_CONF="/etc/sysconfig/docker"
|
|
||||||
echo "OPTIONS=\"\$OPTIONS --mtu=${FLANNEL_MTU} --bip=${FLANNEL_SUBNET}\"" | tee -a ${DOCKER_CONF}
|
|
||||||
if ! command_exists ifconfig; then
|
|
||||||
yum -y -q install net-tools
|
|
||||||
fi
|
|
||||||
ifconfig docker0 down
|
|
||||||
yum -y -q install bridge-utils && brctl delbr docker0 && systemctl restart docker
|
|
||||||
;;
|
|
||||||
amzn)
|
|
||||||
DOCKER_CONF="/etc/sysconfig/docker"
|
|
||||||
echo "OPTIONS=\"\$OPTIONS --mtu=${FLANNEL_MTU} --bip=${FLANNEL_SUBNET}\"" | tee -a ${DOCKER_CONF}
|
|
||||||
ifconfig docker0 down
|
|
||||||
yum -y -q install bridge-utils && brctl delbr docker0 && service docker restart
|
|
||||||
;;
|
|
||||||
ubuntu|debian) # TODO: today ubuntu uses systemd. Handle that too
|
|
||||||
DOCKER_CONF="/etc/default/docker"
|
|
||||||
echo "DOCKER_OPTS=\"\$DOCKER_OPTS --mtu=${FLANNEL_MTU} --bip=${FLANNEL_SUBNET}\"" | tee -a ${DOCKER_CONF}
|
|
||||||
ifconfig docker0 down
|
|
||||||
apt-get install bridge-utils
|
|
||||||
brctl delbr docker0
|
|
||||||
service docker stop
|
|
||||||
while [ `ps aux | grep /usr/bin/docker | grep -v grep | wc -l` -gt 0 ]; do
|
|
||||||
echo "Waiting for docker to terminate"
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
service docker start
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unsupported operations system ${lsb_dist}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# sleep a little bit
|
|
||||||
sleep 5
|
|
||||||
|
|
||||||
# Start kubelet & proxy in container
|
|
||||||
# TODO: Use secure port for communication
|
|
||||||
docker run \
|
|
||||||
--net=host \
|
|
||||||
--pid=host \
|
|
||||||
--privileged \
|
|
||||||
--restart=on-failure \
|
|
||||||
-d \
|
|
||||||
-v /sys:/sys:ro \
|
|
||||||
-v /var/run:/var/run:rw \
|
|
||||||
-v /:/rootfs:ro \
|
|
||||||
-v /var/lib/docker/:/var/lib/docker:rw \
|
|
||||||
-v /var/lib/kubelet/:/var/lib/kubelet:rw \
|
|
||||||
gcr.io/google_containers/hyperkube-${ARCH}:v${K8S_VERSION} \
|
|
||||||
/hyperkube kubelet \
|
|
||||||
--allow-privileged=true \
|
|
||||||
--api-servers=http://${MASTER_IP}:8080 \
|
|
||||||
--address=0.0.0.0 \
|
|
||||||
--enable-server \
|
|
||||||
--cluster-dns=10.0.0.10 \
|
|
||||||
--cluster-domain=cluster.local \
|
|
||||||
--containerized \
|
|
||||||
--v=2
|
|
||||||
|
|
||||||
docker run \
|
|
||||||
-d \
|
|
||||||
--net=host \
|
|
||||||
--privileged \
|
|
||||||
--restart=on-failure \
|
|
||||||
gcr.io/google_containers/hyperkube-${ARCH}:v${K8S_VERSION} \
|
|
||||||
/hyperkube proxy \
|
|
||||||
--master=http://${MASTER_IP}:8080 \
|
|
||||||
--v=2
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "Detecting your OS distro ..."
|
|
||||||
detect_lsb
|
|
||||||
|
|
||||||
echo "Starting bootstrap docker ..."
|
|
||||||
bootstrap_daemon
|
|
||||||
|
|
||||||
echo "Starting k8s ..."
|
|
||||||
start_k8s
|
|
||||||
|
|
||||||
echo "Worker done!"
|
|
Loading…
Reference in New Issue
Block a user