Skip to content

Commit

Permalink
Add quick experience PouchContainer with kubernetes by vagrant
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Liu <manlge168@gmail.com>
  • Loading branch information
manlge committed Sep 10, 2018
1 parent a3d23fd commit cdf3214
Show file tree
Hide file tree
Showing 4 changed files with 257 additions and 55 deletions.
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright The PouchContainer Authors.
#
# 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.

# TEST_FLAGS used as flags of go test.
TEST_FLAGS ?= -v --race

Expand All @@ -16,6 +30,13 @@ INTEGRATION_TESTCASE_BINARY_NAME=pouchd-integration-test
# DEST_DIR is base path used to install pouch & pouchd
DEST_DIR=/usr/local

# PREFIX is base path to install pouch & pouchd
# PREFIX will override the value of DEST_DIR when specified
# example: make install PREFIX=/usr
ifdef PREFIX
DEST_DIR := $(PREFIX)
endif

# the following variables used for the daemon build

# API_VERSION is used for daemon API Version in go build.
Expand Down
51 changes: 43 additions & 8 deletions VAGRANT.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Vagrant support for pouch
# Vagrant support for PouchContainer

You can using [Vagrant](https://www.vagrantup.com) to quickly experience pouch or cross compile on non-linux.
You can using [Vagrant](https://www.vagrantup.com) to quickly experience PouchContainer or cross compile on non-linux.

## Requirements

Expand All @@ -18,21 +18,56 @@ pouch run -d --name nginx -p 80:80 nginx
curl http://localhost
```

## Build pouch with vagrant
## Getting Started with Kubernetes

```bash
# On MacOS or Linux
export POUCH_BUILD=true
# On macOS or Linux
POUCH_KUBE=true vagrant up

# On Windows
set POUCH_KUBE=true
vagrant up

vagrant ssh -c "sudo -i"

$ kubectl cluster-info
Kubernetes master is running at https://10.0.2.15:6443
KubeDNS is running at https://10.0.2.15:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy


$ kubectl get cs
NAME STATUS MESSAGE
controller-manager Healthy ok
scheduler Healthy ok
etcd-0 Healthy {"health": "true"}

$ kubectl get po -o wide --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE
default nginx-6dc97b4cbd-cq4pb 1/1 Running 0 2m 10.244.0.2 pouch
default nginx-6dc97b4cbd-ktlwc 1/1 Running 0 2m 10.244.0.3 pouch
kube-system etcd-pouch 1/1 Running 0 3m 10.0.2.15 pouch
kube-system kube-apiserver-pouch 1/1 Running 0 2m 10.0.2.15 pouch
kube-system kube-controller-manager-pouch 1/1 Running 0 2m 10.0.2.15 pouch
kube-system kube-dns-b4bd9576-gwqzv 3/3 Running 0 2m 10.244.0.4 pouch
kube-system kube-flannel-ds-amd64-vd466 1/1 Running 1 2m 10.0.2.15 pouch
kube-system kube-proxy-c8l8j 1/1 Running 0 2m 10.0.2.15 pouch
kube-system kube-scheduler-pouch 1/1 Running 0 2m 10.0.2.15 pouch
```

## Build pouch with vagrant

```bash
# On macOS or Linux
POUCH_BUILD=true vagrant up

# On Windows
set POUCH_BUILD=true
vagrant up

# Install compiled pouch binarys for pouch service.
# Install compiled pouch binaries for pouch service.
vagrant ssh -c "sudo -i"
cd ~/go/src/github.com/alibaba/pouch
make DEST_DIR=/usr install
make PREFIX=/usr install
systemctl restart pouch
pouch version
```
```
29 changes: 28 additions & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Vagrant.configure("2") do |config|
config.vm.define :pouch do |pouch|
pouch.vm.hostname = "pouch"
pouch.vm.box = "ubuntu/xenial64"
pouch.vm.provider 'virtualbox' do |v, override|
v.memory = 2048
end

pouch.vm.provision "shell", inline: <<-SHELL
until apt-get update &> /dev/null; do echo "Waiting apt-get for 3 seconds..."; sleep 3; done
apt-get --no-install-recommends install lxcfs
Expand Down Expand Up @@ -40,8 +44,31 @@ Vagrant.configure("2") do |config|
mkdir -p $GOPATH/src/github.com/alibaba
ln -s /vagrant $GOPATH/src/github.com/alibaba/pouch
cd $GOPATH/src/github.com/alibaba/pouch && make install
cd $GOPATH/src/github.com/alibaba/pouch
make PREFIX=/usr install
systemctl restart pouch
SHELL
end

if ENV["POUCH_KUBE"] == "true"
env = {
"KUBERNETES_VERSION" => "1.10",
"CRI_VERSION" => "v1alpha2",
"RELEASE_UBUNTU" => "v1.10.2",
"MASTER_NODE" => "true",
"INSTALL_FLANNEL" => "true",
"INSTALL_SAMPLE" => "true"
}

if ENV["http_proxy"] != ""
proxy = ENV["http_proxy"]

env["http_proxy"] = proxy
env["https_proxy"] = proxy
env["no_proxy"] = "localhost,127.0.0.1,10.96.0.0/16,10.0.0.0/16,10.244.0.0/16"
end

pouch.vm.provision "install_kubernetes", type: "shell", path: "hack/kubernetes/allinone_aliyun.sh", env: env
end
end
end
Loading

0 comments on commit cdf3214

Please sign in to comment.