提交 9d2d08a8 编写于 作者: C Christoph Held 提交者: Piotr Bryk

update hyperkube and use nsenter (#1157)

* update hyperkube and use nsenter
上级 c3089451
......@@ -50,7 +50,6 @@ before_script:
# Install go 1.6.1. It is not there by default.
- eval "$(gimme 1.6.1)"
- sudo ./build/setup-docker.sh
- docker --version
script: ./node_modules/.bin/gulp check:local-cluster
......
......@@ -17,33 +17,31 @@
# Learn more at https://github.com/kubernetes/kubernetes/blob/master/docs/getting-started-guides/docker.md
# Version of kubernetes to use.
K8S_VERSION="v1.3.0"
K8S_VERSION="v1.4.0-alpha.3"
# Version heapster to use.
HEAPSTER_VERSION="v1.0.2"
# Port of the apiserver to serve on.
PORT=8080
HEAPSTER_VERSION="v1.1.0"
# Port of the heapster to serve on.
HEAPSTER_PORT=8082
docker run \
--volume=/sys:/sys:ro \
--volume=/dev:/dev \
--volume=/var/lib/docker/:/var/lib/docker:ro \
--volume=/var/lib/kubelet/:/var/lib/kubelet:rw,shared \
--volume=/var/run:/var/run:rw \
--net=host \
--pid=host \
--privileged=true \
-d \
gcr.io/google_containers/hyperkube-amd64:${K8S_VERSION} \
/hyperkube kubelet \
/nsenter \
--target=1 \
--mount \
--wd=. \
-- ./hyperkube kubelet \
--allow-privileged=true \
--hostname-override="127.0.0.1" \
--address="0.0.0.0" \
--api-servers=http://localhost:${PORT} \
--config=/etc/kubernetes/manifests \
--api-servers=http://localhost:8080 \
--config=etc/kubernetes/manifests \
--v=2
# Runs Heapster in standalone mode
docker run --net=host -d gcr.io/google_containers/heapster:${HEAPSTER_VERSION} -port ${HEAPSTER_PORT} \
--source=kubernetes:http://127.0.0.1:${PORT}?inClusterConfig=false&auth=""
--source=kubernetes:http://127.0.0.1:8080?inClusterConfig=false&auth=""
#!/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
......@@ -30,11 +30,7 @@ $ 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.
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:
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.
先完成此消息的编辑!
想要评论请 注册