Skip to content

Commit

Permalink
Merge pull request kubernetes#387 from ddysher/cleanup-log
Browse files Browse the repository at this point in the history
cleanup logs & update README
  • Loading branch information
pendoragon authored and liubog2008 committed Oct 13, 2016
2 parents afd98db + a69d611 commit e967444
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 44 deletions.
26 changes: 10 additions & 16 deletions cluster/caicloud-anchnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,13 @@ used in kube-up. For a full list of options, consult the file.
* `BUILD_VERSION`: The version to build during kube-up (for development mainly). Default value is current date and time, i.e.
`$(TZ=Asia/Shanghai date +%Y-%m-%d-%H-%M)`.
* `KUBE_INSTANCE_LOGDIR`: Directory for holding kubeup instance specific logs. During kube-up, instances will be installed/provisioned
concurrently; if we just send logs to stdout, stdout will mess up. Therefore, we specify a directory to hold instance specific logs.
All other logs will be sent to stdout. Default value is "`/tmp/kubeup-$(TZ=Asia/Shanghai date +%Y-%m-%d-%H-%M-%S)`". The log directory
looks like:
```
$ ls /tmp/kubeup-2015-09-12-01-00-48
$ i-6TDSS52U i-ALCWC66X i-JZ9EDO70 i-THBJ0VCD i-UAAE4SUG
```
where 'i-6TDSS52U' is instance id. Note the variable only catches logs for concurrent instance provisioning; all other logs, like
creating instances from anchnet, will be send to stdout. One common pattern is to set `KUBE_INSTANCE_LOGDIR` and redirect stdout to
`${KUBE_INSTANCE_LOGDIR}/common-logs`.
* `ANCHNET_CONFIG_FILE`: The config file supplied to `anchnet` SDK CLI. Default value is `~/.anchnet/config`. Usually, you don't have
to change the value, unless you want to create cluster under another anchnet account (NOT sub-account).
* `KUBE_DISTRO`: The Linux distribution of underline OS, currently only ubuntu:trusty is supported.
* `REGISTER_MASTER_KUBELET`: The flag controls whether we registry master as a node, this is true by default.
* `ENABLE_CLUSTER_DNS`: Decide if cluster dns addon needs to be created, default to true. DNS addon is essential and should always be true.
* `ENABLE_CLUSTER_LOGGING`: Decide if cluster logging addon needs to be created.
Expand All @@ -131,9 +123,8 @@ used in kube-up. For a full list of options, consult the file.
## Delete a cluster
Deleting a cluster will delete everything associated with the cluster, including instances, vxnet, external ips, firewalls, etc. (TODO:
delete loadbalancer, see [issue](https://github.com/caicloud/caicloud-kubernetes/issues/101)). To bring down a cluster, run:
Deleting a cluster will delete everything associated with the cluster, including instances, vxnet, external ips, firewalls, etc. To bring
down a cluster, run:
```
KUBERNETES_PROVIDER=caicloud-anchnet ./cluster/kube-down.sh
```
Expand Down Expand Up @@ -163,21 +154,24 @@ KUBERNETES_PROVIDER=caicloud-anchnet ./cluster/kube-push.sh
* `CAICLOUD_KUBE_VERSION`: Which version to deploy.
## Add node to a cluster
In case we want to add node(s) to a running cluster, we can run:
```
CLUSTER_NAME=kube-default MASTER_EIP=103.21.116.147 NUM_MINIONS=1 KUBERNETES_PROVIDER=caicloud-anchnet ./cluster/kube-add-node.sh
```
Note this is not working as of now.
## Stop a running cluster
we can simply do the following to shut down a running cluster:
```
CLUSTER_NAME=kube-default KUBERNETES_PROVIDER=caicloud-anchnet ./cluster/kube-halt.sh
```
## Restart a cluster
If we want to restart a cluster which has been stopped before, we can do:
```
CLUSTER_NAME=kube-default KUBERNETES_PROVIDER=caicloud-anchnet ./cluster/kube-restart.sh
Expand Down
6 changes: 0 additions & 6 deletions cluster/caicloud-anchnet/config-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,6 @@ REGISTER_MASTER_KUBELET=${REGISTER_MASTER_KUBELET:-"false"}
# Following params in the section should rarely change.
#

# Directory for holding kubeup instance specific logs. During kube-up, instances
# will be installed/provisioned concurrently; if we just send logs to stdout,
# stdout will mess up. Therefore, we specify a directory to hold instance specific
# logs. All other logs will be sent to stdout, e.g. create instances from anchnet.
KUBE_INSTANCE_LOGDIR=${KUBE_INSTANCE_LOGDIR:-"/tmp/caicloud-kube-`TZ=Asia/Shanghai date +%Y-%m-%d-%H-%M-%S`"}

# URL path of the server hosting caicloud kubernetes release.
CAICLOUD_HOST_URL=${CAICLOUD_HOST_URL:-"http://7xli2p.dl1.z0.glb.clouddn.com"}

Expand Down
3 changes: 0 additions & 3 deletions cluster/caicloud-anchnet/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,8 @@ function kube-up {
# Make sure we have:
# 1. a staging area
# 2. ssh capability
# 3. log directory
ensure-temp-dir
ensure-ssh-agent
ensure-log-dir

if [[ "${KUBE_UP_MODE}" = "dev" ]]; then
# For dev, set to existing instance IDs for master and nodes. Other variables
Expand Down Expand Up @@ -1039,7 +1037,6 @@ function create-anchnet-config {
# NODE_INSTANCE_IDS_ARR
# NODE_IIPS_ARR
# PRIVATE_SDN_INTERFACE
# KUBE_INSTANCE_LOGDIR
function setup-anchnet-instances {
# Use multiple retries since seting up sdn network is essential for follow-up
# installations, and we ses occational errors:
Expand Down
28 changes: 28 additions & 0 deletions cluster/caicloud-baremetal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Caicloud baremetal cloudprovider

Baremetal cloudprovider implements kubernetes cloudprovider plugin. It assumes nothing but a few running instances.

## Create a development cluster

To create a kubernetes cluster for local developement, first create VMs using Vagrant file:
```
vagrant up
```

This will create two ubuntu VMs with dedicated IP addresses. Now, to bring up kubernete cluster, simply run:
```
KUBERNETES_PROVIDER=caicloud-baremetal ./cluster/kube-up.sh
```

#### Options:

There are quite a few options used to create a baremetal cluster, located at `config-default.sh`. Following is a curated list of options
used in kube-up. For a full list of options, consult the file.

* `KUBE_DISTRO`: The Linux distribution of underline OS, currently only ubuntu:trusty is supported.

* `MASTER_SSH_INFO`: The master ssh information in the format of "username:password@ip_address". HA master is currently supported.

* `NODE_SSH_INFO`: The master ssh information in the format of "username:password@ip_address". Multiple nodes are separated via comma.

* `REGISTER_MASTER_KUBELET`: The flag controls whether we registry master as a node, this is true by default.
8 changes: 1 addition & 7 deletions cluster/caicloud-baremetal/config-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# Linux distribution of underline machines.
KUBE_DISTRO=${KUBE_DISTRO:-"trusty"}

# ssh information for master.
# ssh information for master (comma separated string).
MASTER_SSH_INFO=${MASTER_SSH_INFO:-"vagrant:vagrant@192.168.205.10"}

# ssh information for nodes (comma separated string).
Expand Down Expand Up @@ -70,12 +70,6 @@ REGISTER_MASTER_KUBELET=${REGISTER_MASTER_KUBELET:-"true"}
# Following params in the section should rarely change.
#

# Directory for holding kubeup instance specific logs. During kube-up, instances
# will be installed/provisioned concurrently; if we just send logs to stdout,
# stdout will mess up. Therefore, we specify a directory to hold instance specific
# logs. All other logs will be sent to stdout, e.g. create instances from anchnet.
KUBE_INSTANCE_LOGDIR=${KUBE_INSTANCE_LOGDIR:-"/tmp/kubeup-`TZ=Asia/Shanghai date +%Y-%m-%d-%H-%M-%S`"}

# URL path of the server hosting caicloud kubernetes release.
CAICLOUD_HOST_URL=${CAICLOUD_HOST_URL:-"http://7xli2p.dl1.z0.glb.clouddn.com"}

Expand Down
11 changes: 0 additions & 11 deletions cluster/caicloud/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,6 @@ sudo chmod go-rwx /etc/caicloud"
# to master without using password.
#
# Assumed vars:
# KUBE_INSTANCE_LOGDIR
# CAICLOUD_TARBALL_URL
# MASTER_SSH_EXTERNAL *
# NODE_SSH_EXTERNAL *
Expand Down Expand Up @@ -834,16 +833,6 @@ function ensure-ssh-agent {
fi
}

# Make sure log directory exists.
#
# Assumed vars
# KUBE_INSTANCE_LOGDIR
function ensure-log-dir {
if [[ ! -z ${KUBE_INSTANCE_LOGDIR-} ]]; then
mkdir -p ${KUBE_INSTANCE_LOGDIR}
fi
}

# Make sure ~/kube exists on the master/node. This is used in kube-push
# because we now clean up ~/kube directory once the cluster is up and running.
#
Expand Down
1 change: 0 additions & 1 deletion cluster/caicloud/trusty/helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ EOF
# Assumed vars:
# INSTANCE_SSH_EXTERNAL
# APT_MIRRORS
# KUBE_INSTANCE_LOGDIR
function install-packages {
APT_MIRROR_INDEX=0 # Used for choosing an apt mirror.
command-exec-and-retry "install-packages-internal" 2 "${1:-}"
Expand Down

0 comments on commit e967444

Please sign in to comment.