Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Refactor docker-multinode and add a turndown script #21646

Closed
wants to merge 1 commit into from

Conversation

luxas
Copy link
Member

@luxas luxas commented Feb 21, 2016

Work in progress

Feel free to comment on it. Tested on Ubuntu 15.04
Refactor the docker-multinode into a common.sh script. Format the output nicely. Uses a while loop instead of a sleep timeout while waiting for docker-bootstrap, flannel and etcd, which makes it much faster and reliable. Kills running services before starting again and adds a turndown script. Replaces --bip and --mtu docker args instead of appending which makes it possible to run the same script multiple times without editing files by hand. Many variables are now easily editable by exporting.

$ sudo ./master.sh
+++ [0221 22:41:03] K8S_VERSION is set to: 1.2.0-alpha.8
+++ [0221 22:41:03] ETCD_VERSION is set to: 2.2.1
+++ [0221 22:41:03] FLANNEL_VERSION is set to: 0.5.5
+++ [0221 22:41:03] FLANNEL_IFACE is set to: eth0
+++ [0221 22:41:03] FLANNEL_IPMASQ is set to: true
+++ [0221 22:41:03] FLANNEL_NETWORK is set to: 10.1.0.0/16
+++ [0221 22:41:03] FLANNEL_BACKEND is set to: vxlan
+++ [0221 22:41:03] DNS_DOMAIN is set to: cluster.local
+++ [0221 22:41:03] DNS_SERVER_IP is set to: 10.0.0.10
+++ [0221 22:41:03] RESTART_POLICY is set to: on-failure
+++ [0221 22:41:03] MASTER_IP is set to: 192.168.1.130
+++ [0221 22:41:03] ARCH is set to: amd64
+++ [0221 22:41:03] --------------------------------------------
+++ [0221 22:41:03] Detected OS: ubuntu
+++ [0221 22:41:03] Killing docker bootstrap...
a02ada8c0dcb
db252891ed57
+++ [0221 22:41:04] Killing hyperkube containers...
0edf63a11b84
54a5a889762b
fed2f5261272
e5e064c9fe28
97adbc8a0b50
d74d2daa3810
+++ [0221 22:41:34] Killing pause containers...
f2d59059d2d3
5429b04089e8
Do you want to clean /var/lib/kubelet? [Y/n] y
+++ [0221 22:43:22] Launching docker bootstrap...
+++ [0221 22:43:23] Launching etcd...
b5228fb3ccc5a90e7b10d43173003859a44ea2e21155433d024f2e204ff84964
+++ [0221 22:43:24] On try 1, etcd: 
{ "Network": "10.1.0.0/16", "Backend": {"Type": "vxlan"}}
+++ [0221 22:43:26] Launching flannel...
eed14d245a86182ed1c87150a36cab11a9e1731e8415ac5cf7d46d3581c4ea1f
+++ [0221 22:43:28] FLANNEL_SUBNET is set to: 10.1.90.1/24
+++ [0221 22:43:28] FLANNEL_MTU is set to: 1450
+++ [0221 22:43:29] Restarted docker with the new flannel settings
+++ [0221 22:43:29] Launching Kubernetes master components...
fa7c7594e5d41f216852f55aa96a8b296bd2be123a87ff37fb7ccc8663f60f54
+++ [0221 22:43:30] Done. It will take some minutes before apiserver is up though

Also replaced etcd and hyperkube with etcd-amd64 and hyperkube-amd64. Updated some testing docs.
Do you think this should target v1.2 or v1.3?
@fgrzadkowski @dalanlan @brendandburns @resouer @thockin @loopingz


This change is Reviewable

@k8s-github-robot k8s-github-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Feb 21, 2016
@k8s-bot
Copy link

k8s-bot commented Feb 21, 2016

GCE e2e build/test failed for commit ac6a8ec.

@k8s-github-robot
Copy link

PR needs rebase

@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. kind/old-docs labels Feb 28, 2016
@k8s-github-robot
Copy link

Adding label:do-not-merge because PR changes docs prohibited to auto merge
See http://kubernetes.github.io/docs/editdocs/ for information about editting docs

@k8s-github-robot k8s-github-robot added the do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. label Mar 4, 2016
@yidinghan
Copy link

Some error come up when used a cmd of kube::multinode::turndown

docker -H ${BOOTSTRAP_DOCKER_SOCK} rm -f $(docker -H ${BOOTSTRAP_DOCKER_SOCK} ps -q)

Error like this

Failed to remove container (`HASH`): Error response from daemon: Driver devicemapper failed to remove root filesystem `REALLY LONG HASH`: Device is Busy

# Utility functions for Kubernetes in docker setup
# Authors @luxas @wizard_cxy @resouer @loopingz

# Variables
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious: Is it necessary for all this logic to be in bash or can we re-write in Go, if we intend to preserve and maintain this for a long time...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm open to all kinds of solutions. Right now, there is no given place in the repo for this, so let's discuss about what would be the best way of doing it.

For context, see #13901

It would be so much easier if we didn't have to restart docker. I think @mikedanese mentioned it may be possible to not have to (something like this?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also thought about this with @fgrzadkowski

export KUBERNETES_ROLE=(master|worker|unset=local-docker)
export {OTHER OPTS...}
curl -sSL http://get.k8s.io | bash

@jimmyjones2
Copy link
Contributor

@luxas I've been hacking the old one to work on CentOS 6.6+, would it be better to try and fold the changes into this, or raise another PR after this is merged?

@luxas
Copy link
Member Author

luxas commented Apr 14, 2016

@jimmyjones2 Thanks for your comments :)

The main target is #24278.
After that, I'll come back to this PR.
The problem is that docker-multinode has no given place right now.
We will discuss the problem and long-term goals probably elsewhere

@jimmyjones2
Copy link
Contributor

@luxas Should these scripts also starts cluster addons like DNS, UI etc, or at least have an option to?

@luxas luxas mentioned this pull request Apr 18, 2016
gcr.io/google_containers/hyperkube-${ARCH}:v${K8S_VERSION} \
/hyperkube kubelet \
--allow-privileged=true \
--api-servers=http://localhost:8080 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guide also has --address=0.0.0.0 --enable-server --hostname-override=127.0.0.1 Which is right?
Also needs -v /var/log/containers/:/var/log/containers:rw to support logging

@cheld
Copy link
Contributor

cheld commented Apr 28, 2016

@luxas I like the improved script, except the docker reboot and bootstrap :) Can we help you to get rid of it?

--config=/etc/kubernetes/manifests-multi \
--cluster-dns=${DNS_SERVER_IP} \
--cluster-domain=${DNS_DOMAIN} \
--containerized \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is --containerized flag needed? Why don't you use shared volumes solution?

@cheld
Copy link
Contributor

cheld commented May 2, 2016

script is not working with docker 1.11. It is working with docker 1.10.3

@luxas
Copy link
Member Author

luxas commented May 2, 2016

@cheld Thanks for your support.
As you saw, I'm going to move this PR to kube-deploy
Anyway, here's the issue w/ docker-1.11: #24654 (comment)

@luxas
Copy link
Member Author

luxas commented May 14, 2016

Closing in favor for kubernetes-retired/kube-deploy#10

@luxas luxas closed this May 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet