提交 f52117c0 编写于 作者: P Piotr Bryk 提交者: GitHub

Merge pull request #969 from cheld/fix-hyperkube

Prepare hyperkube for 1.3
......@@ -35,6 +35,11 @@ addons:
# Run tests that require a browser on SauceLabs CI provider. Learn more at: https://saucelabs.com
sauce_connect: true
# Docker is required to set up a simple, single node Kubernetes cluster.
# Local Docker-based cluster is the simplest way to create kubernetes on the host machine.
services:
- docker
before_script:
# Prepare environment for the Chrome browser. This is required for PRs from forks where
# tests do not run on Saucelabs.
......@@ -43,10 +48,11 @@ before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
# Docker is required to set up a simple, single node Kubernetes cluster.
# Local Docker-based cluster is the simplest way to create kubernetes on the host machine.
services:
- docker
# Upgrade to docker 1.10+. Answer all questions with yes.
# List available docker versions with "apt-cache madison docker-engine"
- sudo apt-get -o Dpkg::Options::="--force-confnew" install -y docker-engine=1.11.2-0~trusty
- sudo ./build/setup-docker.sh
- docker --version
script: ./node_modules/.bin/gulp check:local-cluster
after_script: ./node_modules/.bin/gulp coverage-codecov-upload
......@@ -17,7 +17,7 @@
# Learn more at https://github.com/kubernetes/kubernetes/blob/master/docs/getting-started-guides/docker.md
# Version of kubernetes to use.
K8S_VERSION="v1.2.4"
K8S_VERSION="v1.3.0"
# Version heapster to use.
HEAPSTER_VERSION="v1.0.2"
# Port of the apiserver to serve on.
......@@ -26,11 +26,10 @@ PORT=8080
HEAPSTER_PORT=8082
docker run \
--volume=/:/rootfs:ro \
--volume=/sys:/sys:ro \
--volume=/dev:/dev \
--volume=/var/lib/docker/:/var/lib/docker:ro \
--volume=/var/lib/kubelet/:/var/lib/kubelet:rw \
--volume=/var/lib/kubelet/:/var/lib/kubelet:rw,shared \
--volume=/var/run:/var/run:rw \
--net=host \
--pid=host \
......@@ -39,7 +38,6 @@ docker run \
gcr.io/google_containers/hyperkube-amd64:${K8S_VERSION} \
/hyperkube kubelet \
--allow-privileged=true \
--containerized \
--hostname-override="127.0.0.1" \
--address="0.0.0.0" \
--api-servers=http://localhost:${PORT} \
......
#!/bin/bash
# Copyright 2015 Google Inc. 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.
# check sudo and enable mount propagation
main() {
check_sudo
if command_exists systemctl; then
restart_docker_systemd
else
make_shared_kubelet_dir
fi
}
# Ensure everything is OK, docker is running and we're root
check_sudo() {
if [[ $(docker ps 2>&1 1>/dev/null; echo $?) != 0 ]]; then
echo "Docker is not running on this machine!"
exit 1
fi
if [[ "$(id -u)" != "0" ]]; then
echo "Please run as root"
exit 1
fi
}
# Check if a command is valid
command_exists() {
command -v "$@" > /dev/null 2>&1
}
# Set shared flag
restart_docker_systemd(){
DOCKER_CONF=$(systemctl cat docker | head -1 | awk '{print $2}')
sed -i.bak 's/^\(MountFlags=\).*/\1shared/' $DOCKER_CONF
systemctl daemon-reload
systemctl restart docker
}
# Make shared kubelet directory
make_shared_kubelet_dir() {
mkdir -p /var/lib/kubelet
mount --bind /var/lib/kubelet /var/lib/kubelet
mount --make-shared /var/lib/kubelet
}
main
......@@ -12,7 +12,7 @@ logic and fetches raw data from the various Kubernetes APIs.
## Preparation
Make sure the following software is installed and added to the `$PATH` variable:
* Docker (1.3+)
* Docker (1.10+)
* go (1.5+)
* nodejs (5.1.1+)
* npm (3+)
......@@ -30,7 +30,11 @@ $ npm install
For development it is recommended to run a local Kubernetes cluster. For your convenience, a
task is provided that checks out the latest stable version, and runs it inside a Docker container.
Open a separate tab in your terminal and run the following command:
First, a Docker setting is required to be adapted. Execute the following script, but only once:
```
$ sudo ./build/setup-docker.sh
```
Then, open a separate tab in your terminal and run the following command:
```
$ gulp local-up-cluster
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册