-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy path02_kubernetes-master
More file actions
84 lines (71 loc) · 2.89 KB
/
Copy path02_kubernetes-master
File metadata and controls
84 lines (71 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#
# Dockerfile - Google Kubernetes
#
# - Build
# docker build --rm -t kubernetes:master -f 02_kubernetes-master .
#
# - Run
# docker run -d --name="kubernetes-master" -h "kubernetes-master" --privileged=true -v /dev:/dev -v /lib/modules:/lib/modules -p 8080:8080 kubernetes:master
#
# - SSH
# ssh `docker inspect -f '{{ .NetworkSettings.IPAddress }}' kubernetes-master`
# Use the base images
FROM ubuntu:16.04
MAINTAINER Yongbok Kim <ruo91@yongbok.net>
# Change the repository
RUN sed -i 's/archive.ubuntu.com/ftp.daumkakao.com/g' /etc/apt/sources.list
# The last update and install package for docker
RUN apt-get update && apt-get install -y supervisor openssh-server nano curl git-core build-essential net-tools iputils-ping bridge-utils
# Variable
ENV SRC_DIR /opt
WORKDIR $SRC_DIR
# GO Language
ENV GO_ARCH linux-amd64
ENV GOROOT $SRC_DIR/go
ENV PATH $PATH:$GOROOT/bin
RUN curl -XGET https://github.com/golang/go/tags | grep tag-name > /tmp/golang_tag \
&& sed -e 's/<[^>]*>//g' /tmp/golang_tag > /tmp/golang_ver \
&& GO_VER=`sed -e 's/ go/go/g' /tmp/golang_ver | head -n 1` && rm -f /tmp/golang_* \
&& curl -LO "https://storage.googleapis.com/golang/$GO_VER.$GO_ARCH.tar.gz" \
&& tar -C $SRC_DIR -xzf go*.tar.gz && rm -rf go*.tar.gz \
&& echo '' >> /etc/profile \
&& echo '# Golang' >> /etc/profile \
&& echo "export GOROOT=$GOROOT" >> /etc/profile \
&& echo 'export PATH=$PATH:$GOROOT/bin' >> /etc/profile \
&& echo '' >> /etc/profile
# Flannel
ENV FLANNEL_HOME $SRC_DIR/flannel
ENV PATH $PATH:$FLANNEL_HOME/bin
RUN git clone https://github.com/coreos/flannel.git \
&& cd flannel && ./build \
&& echo '# flannel'>>/etc/profile \
&& echo "export FLANNEL_HOME=/opt/flannel">>/etc/profile \
&& echo 'export PATH=$PATH:$FLANNEL_HOME/bin'>>/etc/profile \
&& echo ''>>/etc/profile
# Google - Kubernetes
ENV KUBERNETES_HOME $SRC_DIR/kubernetes
ENV PATH $PATH:$KUBERNETES_HOME/server/bin
ADD kubernetes-server-linux-amd64.tar.gz $SRC_DIR
RUN echo '# Kubernetes' >> /etc/profile \
&& echo "export KUBERNETES_HOME=$KUBERNETES_HOME" >> /etc/profile \
&& echo 'export PATH=$PATH:$KUBERNETES_HOME/server/bin' >> /etc/profile \
&& echo '' >> /etc/profile
# Add the kubernetes & flannel scripts
ADD conf/cluster/01_k8s.sh /bin/k8s.sh
ADD conf/network/00_flannel.sh /bin/flannel.sh
ADD conf/cluster/01_k8s_master_add_bridge.sh /bin/k8s_master_add_bridge.sh
RUN chmod a+x /bin/k8s.sh /bin/flannel.sh /bin/k8s_master_add_bridge.sh
# Supervisor
RUN mkdir -p /var/log/supervisor
ADD conf/supervisord/00_default.conf /etc/supervisor/conf.d/supervisord.conf
# SSH
RUN mkdir /var/run/sshd
RUN sed -i '/^#UseLogin/ s:.*:UseLogin yes:' /etc/ssh/sshd_config
RUN sed -i 's/\#AuthorizedKeysFile/AuthorizedKeysFile/g' /etc/ssh/sshd_config
RUN sed -i '/^PermitRootLogin/ s:.*:PermitRootLogin yes:' /etc/ssh/sshd_config
# Set the root password for ssh
RUN echo 'root:kubernetes' |chpasswd
# Port
EXPOSE 22 8080
# Daemon
CMD ["/usr/bin/supervisord"]