install k8s from package
diff --git a/kubernetes/_common.sls b/kubernetes/_common.sls
index 5025617..41adc6f 100644
--- a/kubernetes/_common.sls
+++ b/kubernetes/_common.sls
@@ -4,18 +4,6 @@
pkg.installed:
- names: {{ common.pkgs }}
-kubernetes_binaries:
- cmd.run:
- - name: 'wget -r --no-parent --reject "index.html*" http://apt.tcpcloud.eu/kubernetes/bin/{{ common.binaries_version }}/ && chmod +x -R /root/apt.tcpcloud.eu/kubernetes/bin/{{ common.binaries_version }}/*'
- - pwd: /root
- - unless: test -d /root/apt.tcpcloud.eu/kubernetes/bin/
-
-etcdctl_binaries:
- cmd.run:
- - name: "curl -L https://github.com/coreos/etcd/releases/download/v2.2.1/etcd-v2.2.1-linux-amd64.tar.gz -o etcd-v2.2.1-linux-amd64.tar.gz;tar -zxvf etcd-v2.2.1-linux-amd64.tar.gz"
- - pwd: /root
- - unless: test -f /root/etcd-v2.2.1-linux-amd64.tar.gz
-
{%- if common.network.get('engine', 'none') == 'flannel' %}
flannel-tar:
archive:
diff --git a/kubernetes/files/kube-addons/initd b/kubernetes/files/kube-addons/initd
deleted file mode 100644
index 0ed6f47..0000000
--- a/kubernetes/files/kube-addons/initd
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/bin/bash
-#
-### BEGIN INIT INFO
-# Provides: kube-addons
-# Required-Start: $local_fs $network $syslog kube-apiserver
-# Required-Stop:
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: Kubernetes Addon Object Manager
-# Description:
-# Enforces installation of Kubernetes Addon Objects
-### END INIT INFO
-
-
-# PATH should only include /usr/* if it runs after the mountnfs.sh script
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-DESC="Kubernetes Addon Object Manager"
-NAME=kube-addons
-DAEMON_LOG_FILE=/var/log/${NAME}.log
-PIDFILE=/var/run/${NAME}.pid
-SCRIPTNAME=/etc/init.d/${NAME}
-KUBE_ADDONS_SH=/etc/kubernetes/kube-addons.sh
-
-# Define LSB log_* functions.
-# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
-# and status_of_proc is working.
-. /lib/lsb/init-functions
-
-
-
-
-#
-# Function that starts the daemon/service
-#
-do_start()
-{
- # use setsid to make sure the new daemon has its own group (I suppose
- # start-stop-daemon does create a process group, but let's stay on the
- # safe side).
- setsid start-stop-daemon --start --verbose --background --no-close --make-pidfile --pidfile "${PIDFILE}" --startas "${KUBE_ADDONS_SH}" </dev/null >> ${DAEMON_LOG_FILE} 2>&1
-}
-
-#
-# Function that stops the daemon/service
-#
-do_stop()
-{
- # start-stop-daemon is not used because we have to stop all children
- # limitations:
- # - stop does not work if the pid file is missing
- # - stop does not work if the daemon process is missing (children will not
- # be killed)
- # This is sufficient - remaining processes will end after a while.
-
- local pid
- pid=$(cat "${PIDFILE}" 2> /dev/null)
- if [[ $? != 0 ]]; then
- return 1
- fi
- local pgrp
- # find the process group for the service and kill entire group
- # o - output format: pgpg - process group
- pgrp=$(ps --no-headers --pid "${pid}" -o pgrp 2>/dev/null)
- if [[ $? != 0 ]] || [[ "${pgrp}" == "" ]]; then
- return 1
- fi
- pgrp=$(echo -e ${pgrp}) # strip whitespaces (that's why there are no quotes around pgrp)
- # negative pid is for killing entire group
- kill -- -${pgrp} 2> /dev/null
- if [[ $? != 0 ]]; then
- return 2
- fi
- rm -f "${PIDFILE}"
- return
-}
-
-case "$1" in
- start)
- log_daemon_msg "Starting ${DESC}" "${NAME}"
- do_start
- case "$?" in
- 0|1) log_end_msg 0 || exit 0 ;;
- 2) log_end_msg 1 || exit 1 ;;
- esac
- ;;
- stop)
- log_daemon_msg "Stopping ${DESC}" "${NAME}"
- do_stop
- case "$?" in
- 0|1) log_end_msg 0 || exit 0 ;;
- 2) log_end_msg 1 || exit 1 ;;
- esac
- ;;
- status)
- status_of_proc -p "${PIDFILE}" "${KUBE_ADDONS_SH}" "${NAME}"
- ;;
-
- restart|force-reload)
- log_daemon_msg "Restarting ${DESC}" "${NAME}"
- do_stop
- case "$?" in
- 0|1)
- do_start
- case "$?" in
- 0) log_end_msg 0 ;;
- 1) log_end_msg 1 ;; # Old process is still running
- *) log_end_msg 1 ;; # Failed to start
- esac
- ;;
- *)
- # Failed to stop
- log_end_msg 1
- ;;
- esac
- ;;
- *)
- echo "Usage: ${SCRIPTNAME} {start|stop|status|restart|force-reload}" >&2
- exit 3
- ;;
-esac
\ No newline at end of file
diff --git a/kubernetes/files/kube-gen-token.sh b/kubernetes/files/kube-gen-token.sh
deleted file mode 100644
index fa6a5dd..0000000
--- a/kubernetes/files/kube-gen-token.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-
-# Copyright 2015 The Kubernetes Authors 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.
-
-token_dir=${TOKEN_DIR:-/var/srv/kubernetes}
-token_file="${token_dir}/known_tokens.csv"
-
-create_accounts=($@)
-
-touch "${token_file}"
-for account in "${create_accounts[@]}"; do
- if grep ",${account}," "${token_file}" ; then
- continue
- fi
- token=$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64 | tr -d "=+/" | dd bs=32 count=1 2>/dev/null)
- echo "${token},${account},${account}" >> "${token_file}"
- echo "${token}" > "${token_dir}/${account}.token"
- echo "Added ${account}"
-done
diff --git a/kubernetes/files/kube-proxy/default b/kubernetes/files/kube-proxy/default
deleted file mode 100644
index b7dddc1..0000000
--- a/kubernetes/files/kube-proxy/default
+++ /dev/null
@@ -1,5 +0,0 @@
-{%- from "kubernetes/map.jinja" import pool with context %}
-
-# test_args has to be kept at the end, so they'll overwrite any prior configuration
-DAEMON_ARGS="--logtostderr=true --v=2 --kubeconfig=/var/lib/kube-proxy/kubeconfig --master=https://{{ pool.master.host }}{% if pool.network.engine == 'calico' %} --proxy-mode=iptables{% endif %}"
-#--kubeconfig=/etc/kubernetes/proxy.kubeconfig"
\ No newline at end of file
diff --git a/kubernetes/files/kube-proxy/initd b/kubernetes/files/kube-proxy/initd
deleted file mode 100644
index b530b32..0000000
--- a/kubernetes/files/kube-proxy/initd
+++ /dev/null
@@ -1,130 +0,0 @@
-#!/bin/bash
-#
-### BEGIN INIT INFO
-# Provides: kube-proxy
-# Required-Start: $local_fs $network $syslog
-# Required-Stop:
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: The Kubernetes network proxy
-# Description:
-# The Kubernetes network proxy enables network redirection and
-# loadbalancing for dynamically placed containers.
-### END INIT INFO
-
-
-# PATH should only include /usr/* if it runs after the mountnfs.sh script
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-DESC="The Kubernetes network proxy"
-NAME=kube-proxy
-DAEMON=/usr/local/bin/kube-proxy
-DAEMON_ARGS=""
-DAEMON_LOG_FILE=/var/log/$NAME.log
-PIDFILE=/var/run/$NAME.pid
-SCRIPTNAME=/etc/init.d/$NAME
-DAEMON_USER=root
-
-# Exit if the package is not installed
-[ -x "$DAEMON" ] || exit 0
-
-# Read configuration variable file if it is present
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
-
-# Define LSB log_* functions.
-# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
-# and status_of_proc is working.
-. /lib/lsb/init-functions
-
-#
-# Function that starts the daemon/service
-#
-do_start()
-{
- # Avoid a potential race at boot time when both monit and init.d start
- # the same service
- PIDS=$(pidof $DAEMON)
- for PID in ${PIDS}; do
- kill -9 $PID
- done
-
- # Raise the file descriptor limit - we expect to open a lot of sockets!
- ulimit -n 65536
-
- # Return
- # 0 if daemon has been started
- # 1 if daemon was already running
- # 2 if daemon could not be started
- start-stop-daemon --start --quiet --background --no-close \
- --make-pidfile --pidfile $PIDFILE \
- --exec $DAEMON -c $DAEMON_USER --test > /dev/null \
- || return 1
- start-stop-daemon --start --quiet --background --no-close \
- --make-pidfile --pidfile $PIDFILE \
- --exec $DAEMON -c $DAEMON_USER -- \
- $DAEMON_ARGS >> $DAEMON_LOG_FILE 2>&1 \
- || return 2
-}
-
-#
-# Function that stops the daemon/service
-#
-do_stop()
-{
- # Return
- # 0 if daemon has been stopped
- # 1 if daemon was already stopped
- # 2 if daemon could not be stopped
- # other if a failure occurred
- start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
- RETVAL="$?"
- [ "$RETVAL" = 2 ] && return 2
- # Many daemons don't delete their pidfiles when they exit.
- rm -f $PIDFILE
- return "$RETVAL"
-}
-
-
-case "$1" in
- start)
- log_daemon_msg "Starting $DESC" "$NAME"
- do_start
- case "$?" in
- 0|1) log_end_msg 0 || exit 0 ;;
- 2) log_end_msg 1 || exit 1 ;;
- esac
- ;;
- stop)
- log_daemon_msg "Stopping $DESC" "$NAME"
- do_stop
- case "$?" in
- 0|1) log_end_msg 0 ;;
- 2) exit 1 ;;
- esac
- ;;
- status)
- status_of_proc -p $PIDFILE "$DAEMON" "$NAME" && exit 0 || exit $?
- ;;
-
- restart|force-reload)
- log_daemon_msg "Restarting $DESC" "$NAME"
- do_stop
- case "$?" in
- 0|1)
- do_start
- case "$?" in
- 0) log_end_msg 0 ;;
- 1) log_end_msg 1 ;; # Old process is still running
- *) log_end_msg 1 ;; # Failed to start
- esac
- ;;
- *)
- # Failed to stop
- log_end_msg 1
- ;;
- esac
- ;;
- *)
- echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
- exit 3
- ;;
-esac
\ No newline at end of file
diff --git a/kubernetes/files/kube-proxy/kube-proxy.service b/kubernetes/files/kube-proxy/kube-proxy.service
deleted file mode 100644
index ebd5729..0000000
--- a/kubernetes/files/kube-proxy/kube-proxy.service
+++ /dev/null
@@ -1,12 +0,0 @@
-[Unit]
-Description=Kubernetes Kube-Proxy Server
-Documentation=https://github.com/GoogleCloudPlatform/kubernetes
-
-[Service]
-EnvironmentFile=/etc/sysconfig/kube-proxy
-ExecStart=/usr/local/bin/kube-proxy "$DAEMON_ARGS"
-Restart=on-failure
-LimitNOFILE=65536
-
-[Install]
-WantedBy=multi-user.target
\ No newline at end of file
diff --git a/kubernetes/files/kubelet/initd b/kubernetes/files/kubelet/initd
deleted file mode 100644
index 74f69a2..0000000
--- a/kubernetes/files/kubelet/initd
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/bin/bash
-#
-### BEGIN INIT INFO
-# Provides: kubelet
-# Required-Start: $local_fs $network $syslog
-# Required-Stop:
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: The Kubernetes node container manager
-# Description:
-# The Kubernetes container manager maintains docker state against a state file.
-### END INIT INFO
-
-
-# PATH should only include /usr/* if it runs after the mountnfs.sh script
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-DESC="The Kubernetes container manager"
-NAME=kubelet
-DAEMON=/usr/local/bin/kubelet
-DAEMON_ARGS=""
-DAEMON_LOG_FILE=/var/log/$NAME.log
-PIDFILE=/var/run/$NAME.pid
-SCRIPTNAME=/etc/init.d/$NAME
-DAEMON_USER=root
-
-# Exit if the package is not installed
-[ -x "$DAEMON" ] || exit 0
-
-# Read configuration variable file if it is present
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
-
-# Define LSB log_* functions.
-# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
-# and status_of_proc is working.
-. /lib/lsb/init-functions
-
-#
-# Function that starts the daemon/service
-#
-do_start()
-{
- # Avoid a potential race at boot time when both monit and init.d start
- # the same service
- PIDS=$(pidof $DAEMON)
- for PID in ${PIDS}; do
- kill -9 $PID
- done
-
- # Return
- # 0 if daemon has been started
- # 1 if daemon was already running
- # 2 if daemon could not be started
- start-stop-daemon --start --quiet --background --no-close \
- --make-pidfile --pidfile $PIDFILE \
- --exec $DAEMON -c $DAEMON_USER --test > /dev/null \
- || return 1
- start-stop-daemon --start --quiet --background --no-close \
- --make-pidfile --pidfile $PIDFILE \
- --exec $DAEMON -c $DAEMON_USER -- \
- $DAEMON_ARGS >> $DAEMON_LOG_FILE 2>&1 \
- || return 2
-}
-
-#
-# Function that stops the daemon/service
-#
-do_stop()
-{
- # Return
- # 0 if daemon has been stopped
- # 1 if daemon was already stopped
- # 2 if daemon could not be stopped
- # other if a failure occurred
- start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
- RETVAL="$?"
- [ "$RETVAL" = 2 ] && return 2
- # Many daemons don't delete their pidfiles when they exit.
- rm -f $PIDFILE
- return "$RETVAL"
-}
-
-
-case "$1" in
- start)
- log_daemon_msg "Starting $DESC" "$NAME"
- do_start
- case "$?" in
- 0|1) log_end_msg 0 || exit 0 ;;
- 2) log_end_msg 1 || exit 1 ;;
- esac
- ;;
- stop)
- log_daemon_msg "Stopping $DESC" "$NAME"
- do_stop
- case "$?" in
- 0|1) log_end_msg 0 ;;
- 2) exit 1 ;;
- esac
- ;;
- status)
- status_of_proc -p $PIDFILE "$DAEMON" "$NAME" && exit 0 || exit $?
- ;;
-
- restart|force-reload)
- log_daemon_msg "Restarting $DESC" "$NAME"
- do_stop
- case "$?" in
- 0|1)
- do_start
- case "$?" in
- 0) log_end_msg 0 ;;
- 1) log_end_msg 1 ;; # Old process is still running
- *) log_end_msg 1 ;; # Failed to start
- esac
- ;;
- *)
- # Failed to stop
- log_end_msg 1
- ;;
- esac
- ;;
- *)
- echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
- exit 3
- ;;
-esac
\ No newline at end of file
diff --git a/kubernetes/files/kubelet/kubelet.service b/kubernetes/files/kubelet/kubelet.service
deleted file mode 100644
index 0c5b653..0000000
--- a/kubernetes/files/kubelet/kubelet.service
+++ /dev/null
@@ -1,11 +0,0 @@
-[Unit]
-Description=Kubernetes Kubelet Server
-Documentation=https://github.com/GoogleCloudPlatform/kubernetes
-
-[Service]
-EnvironmentFile=/etc/sysconfig/kubelet
-ExecStart=/usr/local/bin/kubelet "$DAEMON_ARGS"
-Restart=always
-
-[Install]
-WantedBy=multi-user.target
\ No newline at end of file
diff --git a/kubernetes/files/manifest/cadvisor.manifest b/kubernetes/files/manifest/cadvisor.manifest
deleted file mode 100644
index 5c90e91..0000000
--- a/kubernetes/files/manifest/cadvisor.manifest
+++ /dev/null
@@ -1,39 +0,0 @@
-apiVersion: v1
-kind: Pod
-metadata:
- name: cadvisor
- namespace: kube-system
-spec:
- containers:
- - name: cadvisor
- image: google/cadvisor:latest
- ports:
- - name: http
- containerPort: 8080
- hostPort: 8080
- volumeMounts:
- - name: root
- mountPath: /rootfs
- readOnly: true
- - name: varrun
- mountPath: /var/run
- readOnly: false
- - name: varlibdocker
- mountPath: /var/lib/docker
- readOnly: true
- - name: sys
- mountPath: /sys
- readOnly: true
- volumes:
- - name: root
- hostPath:
- path: /
- - name: varrun
- hostPath:
- path: /var/run
- - name: varlibdocker
- hostPath:
- path: /var/lib/docker
- - name: sys
- hostPath:
- path: /sys
\ No newline at end of file
diff --git a/kubernetes/files/manifest/kube-proxy.manifest b/kubernetes/files/manifest/kube-proxy.manifest.pool
similarity index 63%
rename from kubernetes/files/manifest/kube-proxy.manifest
rename to kubernetes/files/manifest/kube-proxy.manifest.pool
index 23b46f4..92e1602 100644
--- a/kubernetes/files/manifest/kube-proxy.manifest
+++ b/kubernetes/files/manifest/kube-proxy.manifest.pool
@@ -15,12 +15,12 @@
command:
- /bin/sh
- -c
- - kube-proxy
- --logtostderr=true
- --v=2
- --kubeconfig=/etc/kubernetes/proxy.kubeconfig
+ - kube-proxy
+ --logtostderr=true
+ --v=2
+ --kubeconfig=/etc/kubernetes/proxy.kubeconfig
--master=https://{{ pool.master.host }}
- {% if pool.network.engine == 'calico' %}--proxy-mode=iptables{% endif %}
+ {%- if pool.network.engine == 'calico' %}--proxy-mode=iptables{% endif %}
1>>/var/log/kube-proxy.log 2>&1
securityContext:
privileged: true
@@ -31,16 +31,22 @@
- mountPath: /var/log
name: varlog
readOnly: false
- - mountPath: /var/lib/kube-proxy/kubeconfig
+ - mountPath: /etc/kubernetes/proxy.kubeconfig
name: kubeconfig
readOnly: false
+ - mountPath: /var/run/dbus/system_bus_socket
+ name: dbus
+ readOnly: false
volumes:
- hostPath:
- path: /usr/share/ca-certificates
+ path: /etc/ssl/certs
name: ssl-certs-host
- hostPath:
- path: /var/lib/kube-proxy/kubeconfig
+ path: /etc/kubernetes/proxy.kubeconfig
name: kubeconfig
- hostPath:
path: /var/log
- name: varlog
\ No newline at end of file
+ name: varlog
+ - hostPath:
+ path: /var/run/dbus/system_bus_socket
+ name: dbus
\ No newline at end of file
diff --git a/kubernetes/map.jinja b/kubernetes/map.jinja
index 9c9f82b..ac2c76e 100644
--- a/kubernetes/map.jinja
+++ b/kubernetes/map.jinja
@@ -1,6 +1,6 @@
{% set common = salt['grains.filter_by']({
'Debian': {
- 'pkgs': ['curl', 'git', 'apt-transport-https', 'python-apt', 'nfs-common', 'socat', 'netcat-traditional', 'openssl'],
+ 'pkgs': ['curl', 'git', 'apt-transport-https', 'python-apt', 'nfs-common', 'socat', 'netcat-traditional', 'openssl', 'kubernetes-client', 'kubernetes-node'],
'services': [],
},
'RedHat': {
@@ -11,8 +11,8 @@
{% set master = salt['grains.filter_by']({
'Debian': {
- 'pkgs': [],
- 'services': [],
+ 'pkgs': ['kubernetes-master'],
+ 'services': ['kubelet'],
},
'RedHat': {
'pkgs': [],
@@ -23,7 +23,7 @@
{% set pool = salt['grains.filter_by']({
'Debian': {
'pkgs': [],
- 'services': [],
+ 'services': ['kubelet'],
},
'RedHat': {
'pkgs': [],
diff --git a/kubernetes/master/kubelet.sls b/kubernetes/master/kubelet.sls
index 78bf5a7..725552f 100644
--- a/kubernetes/master/kubelet.sls
+++ b/kubernetes/master/kubelet.sls
@@ -1,13 +1,7 @@
{%- from "kubernetes/map.jinja" import master with context %}
{%- if master.enabled %}
-{% if pillar.get('is_systemd') %}
-{% set environment_file = '/etc/sysconfig/kubelet' %}
-{% else %}
-{% set environment_file = '/etc/default/kubelet' %}
-{% endif %}
-
-{{ environment_file }}:
+/etc/default/kubelet:
file.managed:
- source: salt://kubernetes/files/kubelet/default.master
- template: jinja
@@ -15,53 +9,14 @@
- group: root
- mode: 644
-/usr/local/bin/kubelet:
- file.managed:
- - user: root
- - group: root
- - mode: 755
+/etc/kubernetes/config:
+ file.absent
-{% if pillar.get('is_systemd') %}
-
-{{ pillar.get('systemd_system_path') }}/kubelet.service:
- file.managed:
- - source: salt://kubernetes/files/kubelet/kubelet.service
- - user: root
- - group: root
-
-fix-service-kubelet:
- cmd.wait:
- - name: /opt/kubernetes/helpers/services bounce kubelet
- - watch:
- - file: /usr/local/bin/kubelet
- - file: {{ pillar.get('systemd_system_path') }}/kubelet.service
- - file: {{ environment_file }}
- - file: /var/lib/kubelet/kubeconfig
-
-{% else %}
-
-/etc/init.d/kubelet:
- file.managed:
- - source: salt://kubernetes/files/kubelet/initd
- - user: root
- - group: root
- - mode: 755
-
-{% endif %}
-
-kubelet:
+master_services:
service.running:
- - enable: True
- - watch:
- - file: /usr/local/bin/kubelet
-{% if pillar.get('is_systemd') %}
- - file: {{ pillar.get('systemd_system_path') }}/kubelet.service
-{% else %}
- - file: /etc/init.d/kubelet
-{% endif %}
-{% if grains['os_family'] == 'RedHat' %}
- - file: /usr/lib/systemd/system/kubelet.service
-{% endif %}
- - file: {{ environment_file }}
+ - names: {{ master.services }}
+ - enable: True
+ - watch:
+ - file: /etc/default/kubelet
{%- endif %}
\ No newline at end of file
diff --git a/kubernetes/master/service.sls b/kubernetes/master/service.sls
index 1f6c562..24136ee 100644
--- a/kubernetes/master/service.sls
+++ b/kubernetes/master/service.sls
@@ -6,28 +6,8 @@
include:
- kubernetes._common
-kubernetes_master_binaries:
- cmd.run:
- - names:
- - "cp /root/apt.tcpcloud.eu/kubernetes/bin/{{ common.binaries_version }}/kubectl /usr/bin/"
- - "cp /root/apt.tcpcloud.eu/kubernetes/bin/{{ common.binaries_version }}/kubelet /usr/local/bin/"
- - "cp /root/etcd-v2.2.1-linux-amd64/etcdctl /usr/bin/"
- - unless: test -f /usr/local/bin/kubelet && test -f /usr/bin/kubectl && test -f /usr/bin/etcdctl
- - require:
- - cmd: kubernetes_binaries
-
-kubernetes_master_cert_group:
- group.present:
- - name: kube-cert
- - system: True
-
-kubernetes_master_cert_dir:
- file.directory:
- - name: /srv/kubernetes/
- - mode: 750
- - group: kube-cert
- - makedirs: True
- - requires:
- - group: kubernetes_master_cert_group
+kubernetes_master_pkgs:
+ pkg.installed:
+ - names: {{ master.pkgs }}
{%- endif %}
\ No newline at end of file
diff --git a/kubernetes/pool/kube-proxy.sls b/kubernetes/pool/kube-proxy.sls
index 6a406a2..e444604 100644
--- a/kubernetes/pool/kube-proxy.sls
+++ b/kubernetes/pool/kube-proxy.sls
@@ -1,70 +1,17 @@
{%- from "kubernetes/map.jinja" import pool with context %}
{%- if pool.enabled %}
-{% if pillar.get('is_systemd') %}
-{% set environment_file = '/etc/sysconfig/kube-proxy' %}
-{% else %}
-{% set environment_file = '/etc/default/kube-proxy' %}
-{% endif %}
-
-{{ environment_file }}:
+/etc/kubernetes/manifests/kube-proxy.manifest:
file.managed:
- - source: salt://kubernetes/files/kube-proxy/default
+ - source: salt://kubernetes/files/manifest/kube-proxy.manifest.pool
- template: jinja
- user: root
- group: root
- mode: 644
+ - makedirs: true
+ - dir_mode: 755
-kube-proxy:
- group.present:
- - system: True
- user.present:
- - system: True
- - gid_from_name: True
- - shell: /sbin/nologin
- - home: /var/kube-proxy
- - require:
- - group: kube-proxy
-
-{% if pillar.get('is_systemd') %}
-
-{{ pillar.get('systemd_system_path') }}/kube-proxy.service:
- file.managed:
- - source: salt://kubernetes/files/kube-proxy/kube-proxy.service
- - user: root
- - group: root
- cmd.wait:
- - name: /opt/kubernetes/helpers/services bounce kube-proxy
- - watch:
- - file: {{ environment_file }}
- - file: {{ pillar.get('systemd_system_path') }}/kube-proxy.service
- - file: /var/lib/kube-proxy/kubeconfig
-
-{% else %}
-
-/etc/init.d/kube-proxy:
- file.managed:
- - source: salt://kubernetes/files/kube-proxy/initd
- - user: root
- - group: root
- - mode: 755
-
-{% endif %}
-
-kube-proxy-service:
- service.running:
- - name: kube-proxy
- - enable: True
- - watch:
- - file: {{ environment_file }}
-{% if pillar.get('is_systemd') %}
- - file: {{ pillar.get('systemd_system_path') }}/kube-proxy.service
-{% else %}
- - file: /etc/init.d/kube-proxy
-{% endif %}
- - file: /etc/kubernetes/proxy.kubeconfig
-
-/var/lib/kube-proxy/kubeconfig:
+/etc/kubernetes/proxy.kubeconfig:
file.managed:
- source: salt://kubernetes/files/kube-proxy/proxy.kubeconfig
- template: jinja
@@ -73,20 +20,5 @@
- mode: 644
- makedirs: true
-/etc/kubernetes/manifests/kube-proxy.manifest:
- file.managed:
- - source: salt://kubernetes/files/manifest/kube-proxy.manifest
- - template: jinja
- - user: root
- - group: root
- - mode: 644
- - makedirs: true
- - dir_mode: 755
-/var/log/kube-controller-manager.log:
- file.managed:
- - user: root
- - group: root
- - mode: 644
-
-{% endif %}
\ No newline at end of file
+{%- endif %}
\ No newline at end of file
diff --git a/kubernetes/pool/kubelet.sls b/kubernetes/pool/kubelet.sls
index 022efb3..0b20cf8 100644
--- a/kubernetes/pool/kubelet.sls
+++ b/kubernetes/pool/kubelet.sls
@@ -1,13 +1,7 @@
{%- from "kubernetes/map.jinja" import pool with context %}
{%- if pool.enabled %}
-{% if pillar.get('is_systemd') %}
-{% set environment_file = '/etc/sysconfig/kubelet' %}
-{% else %}
-{% set environment_file = '/etc/default/kubelet' %}
-{% endif %}
-
-{{ environment_file }}:
+/etc/default/kubelet:
file.managed:
- source: salt://kubernetes/files/kubelet/default.pool
- template: jinja
@@ -15,12 +9,6 @@
- group: root
- mode: 644
-/usr/local/bin/kubelet:
- file.managed:
- - user: root
- - group: root
- - mode: 755
-
/etc/kubernetes/kubelet.kubeconfig:
file.managed:
- source: salt://kubernetes/files/kubelet/kubelet.kubeconfig
@@ -30,57 +18,14 @@
- mode: 644
- makedirs: true
+/etc/kubernetes/config:
+ file.absent
-{% if pillar.get('is_systemd') %}
-
-{{ pillar.get('systemd_system_path') }}/kubelet.service:
- file.managed:
- - source: salt://kubernetes/files/kubelet/kubelet.service
- - user: root
- - group: root
-
-fix-service-kubelet:
- cmd.wait:
- - name: /opt/kubernetes/helpers/services bounce kubelet
- - watch:
- - file: /usr/local/bin/kubelet
- - file: {{ pillar.get('systemd_system_path') }}/kubelet.service
- - file: {{ environment_file }}
- - file: /var/lib/kubelet/kubeconfig
-
-{% else %}
-
-/etc/init.d/kubelet:
- file.managed:
- - source: salt://kubernetes/files/kubelet/initd
- - user: root
- - group: root
- - mode: 755
-
-{% endif %}
-
-/etc/kubernetes/manifests/cadvisor.manifest:
- file.managed:
- - source: salt://kubernetes/files/manifest/cadvisor.manifest
- - user: root
- - group: root
- - mode: 644
- - makedirs: true
- - template: jinja
-
-kubelet:
+pool_services:
service.running:
- - enable: True
- - watch:
- - file: /usr/local/bin/kubelet
-{% if pillar.get('is_systemd') %}
- - file: {{ pillar.get('systemd_system_path') }}/kubelet.service
-{% else %}
- - file: /etc/init.d/kubelet
-{% endif %}
-{% if grains['os_family'] == 'RedHat' %}
- - file: /usr/lib/systemd/system/kubelet.service
-{% endif %}
- - file: {{ environment_file }}
- - file: /etc/kubernetes/kubelet.kubeconfig
+ - names: {{ pool.services }}
+ - enable: True
+ - watch:
+ - file: /etc/default/kubelet
+
{%- endif %}
\ No newline at end of file
diff --git a/kubernetes/pool/service.sls b/kubernetes/pool/service.sls
index c104889..743bee4 100644
--- a/kubernetes/pool/service.sls
+++ b/kubernetes/pool/service.sls
@@ -5,14 +5,4 @@
include:
- kubernetes._common
-kubernetes_pool_binaries:
- cmd.run:
- - names:
- - "cp /root/apt.tcpcloud.eu/kubernetes/bin/{{ common.binaries_version }}/kube-proxy /usr/local/bin/"
- - "cp /root/apt.tcpcloud.eu/kubernetes/bin/{{ common.binaries_version }}/kubectl /usr/bin/"
- - "cp /root/apt.tcpcloud.eu/kubernetes/bin/{{ common.binaries_version }}/kubelet /usr/local/bin/"
- - unless: test -f /usr/local/bin/kubelet && test -f /usr/local/bin/kube-proxy && test -f /usr/bin/kubectl
- - require:
- - cmd: kubernetes_binaries
-
{%- endif %}
\ No newline at end of file
diff --git a/metadata/service/common.yml b/metadata/service/common.yml
index 47364d9..f1f8197 100644
--- a/metadata/service/common.yml
+++ b/metadata/service/common.yml
@@ -1,6 +1,5 @@
parameters:
kubernetes:
common:
- binaries_version: v1.1.1
network:
engine: none
\ No newline at end of file
diff --git a/metadata/service/master/cluster.yml b/metadata/service/master/cluster.yml
index c528ed3..2d118ff 100644
--- a/metadata/service/master/cluster.yml
+++ b/metadata/service/master/cluster.yml
@@ -17,7 +17,7 @@
kubernetes:
master:
enabled: true
- version: v1.2.0
+ version: ${_param:kubernetes_version}
registry: tcpcloud
service_addresses: 10.254.0.0/16
admin:
diff --git a/metadata/service/master/single.yml b/metadata/service/master/single.yml
index 779359f..e240ed6 100644
--- a/metadata/service/master/single.yml
+++ b/metadata/service/master/single.yml
@@ -17,7 +17,7 @@
kubernetes:
master:
enabled: true
- version: v1.2.0
+ version: ${_param:kubernetes_version}
registry: tcpcloud
service_addresses: 10.254.0.0/16
admin:
diff --git a/metadata/service/pool/cluster.yml b/metadata/service/pool/cluster.yml
index cebe9fc..e05d323 100644
--- a/metadata/service/pool/cluster.yml
+++ b/metadata/service/pool/cluster.yml
@@ -7,7 +7,8 @@
kubernetes:
pool:
enabled: true
- version: v1.2.0
+ version: ${_param:kubernetes_version}
+ registry: tcpcloud
master:
host: ${_param:cluster_vip_address}
apiserver:
diff --git a/metadata/service/pool/single.yml b/metadata/service/pool/single.yml
index b219527..b4bb7df 100644
--- a/metadata/service/pool/single.yml
+++ b/metadata/service/pool/single.yml
@@ -7,7 +7,8 @@
kubernetes:
pool:
enabled: true
- version: v1.2.0
+ version: ${_param:kubernetes_version}
+ registry: tcpcloud
master:
host: ${_param:master_address}
apiserver: