Commit 13afe18a authored by Euan Kemp's avatar Euan Kemp Committed by Euan Kemp

cluster/coreos: update to gci based implementation

This update includes significant refactoring. It moves almost all of the logic into bash scripts, modeled after the `gci` cluster scripts. The primary differences between the two are the following: 1. Use of the `/opt/kubernetes` directory over `/home/kubernetes` 2. Support for rkt as a runtime 3. No use of logrotate 4. No use of `/etc/default/` 5. No logic related to noexec mounts or gci-specific firewall-stuff
parent e2644bb4
...@@ -331,14 +331,12 @@ function kube::release::package_kube_manifests_tarball() { ...@@ -331,14 +331,12 @@ function kube::release::package_kube_manifests_tarball() {
cp "${KUBE_ROOT}/cluster/gce/gci/configure-helper.sh" "${dst_dir}/gci-configure-helper.sh" cp "${KUBE_ROOT}/cluster/gce/gci/configure-helper.sh" "${dst_dir}/gci-configure-helper.sh"
cp "${KUBE_ROOT}/cluster/gce/gci/mounter/mounter" "${dst_dir}/gci-mounter" cp "${KUBE_ROOT}/cluster/gce/gci/mounter/mounter" "${dst_dir}/gci-mounter"
cp "${KUBE_ROOT}/cluster/gce/gci/health-monitor.sh" "${dst_dir}/health-monitor.sh" cp "${KUBE_ROOT}/cluster/gce/gci/health-monitor.sh" "${dst_dir}/health-monitor.sh"
cp "${KUBE_ROOT}/cluster/gce/coreos/configure-helper.sh" "${dst_dir}/coreos-configure-helper.sh"
cp -r "${salt_dir}/kube-admission-controls/limit-range" "${dst_dir}" cp -r "${salt_dir}/kube-admission-controls/limit-range" "${dst_dir}"
local objects local objects
objects=$(cd "${KUBE_ROOT}/cluster/addons" && find . \( -name \*.yaml -or -name \*.yaml.in -or -name \*.json \) | grep -v demo) objects=$(cd "${KUBE_ROOT}/cluster/addons" && find . \( -name \*.yaml -or -name \*.yaml.in -or -name \*.json \) | grep -v demo)
tar c -C "${KUBE_ROOT}/cluster/addons" ${objects} | tar x -C "${dst_dir}" tar c -C "${KUBE_ROOT}/cluster/addons" ${objects} | tar x -C "${dst_dir}"
# This is for coreos only. ContainerVM, GCI, or Trusty does not use it.
cp -r "${KUBE_ROOT}/cluster/gce/coreos/kube-manifests"/* "${release_stage}/"
kube::release::clean_cruft kube::release::clean_cruft
local package_name="${RELEASE_DIR}/kubernetes-manifests.tar.gz" local package_name="${RELEASE_DIR}/kubernetes-manifests.tar.gz"
......
# This file should be kept in sync with cluster/gce/coreos/kube-manifests/addons/dashboard/dashboard-controller.yaml
apiVersion: extensions/v1beta1 apiVersion: extensions/v1beta1
kind: Deployment kind: Deployment
metadata: metadata:
......
# This file should be kept in sync with cluster/gce/coreos/kube-manifests/addons/dashboard/dashboard-service.yaml
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
......
# Container-VM Image # CoreOS image
[Container-VM Image](https://cloud.google.com/compute/docs/containers/vm-image/) The [CoreOS operating system](https://coreos.com/why/) is a Linux distribution optimized for running containers securely at scale.
is a container-optimized OS image for the Google Cloud Platform (GCP). It is CoreOS provides [an image](https://coreos.com/os/docs/latest/booting-on-google-compute-engine.html) for Google Cloud Platform (GCP).
primarily for running Google services on GCP. Unlike the open preview version
of container-vm, the new Container-VM Image is based on the open source
ChromiumOS project, allowing us greater control over the build management,
security compliance, and customizations for GCP.
This folder contains configuration and tooling to allow kube-up to create a Kubernetes cluster on Google Cloud Platform running on the official CoreOS image.
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/cluster/gce/gci/README.md?pixel)]() [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/cluster/gce/coreos/README.md?pixel)]()
...@@ -14,30 +14,10 @@ ...@@ -14,30 +14,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# Due to the GCE custom metadata size limit, we split the entire script into two
# files configure.sh and configure-helper.sh. The functionality of downloading
# kubernetes configuration, manifests, docker images, and binary files are
# put in configure.sh, which is uploaded via GCE custom metadata.
set -o errexit set -o errexit
set -o nounset set -o nounset
set -o pipefail set -o pipefail
function set-broken-motd {
cat > /etc/motd <<EOF
Broken (or in progress) Kubernetes node setup! Check the cluster initialization status
using the following commands.
Master instance:
- sudo systemctl status kube-master-installation
- sudo systemctl status kube-master-configuration
Node instance:
- sudo systemctl status kube-node-installation
- sudo systemctl status kube-node-configuration
EOF
}
function download-kube-env { function download-kube-env {
# Fetch kube-env from GCE metadata server. # Fetch kube-env from GCE metadata server.
local -r tmp_kube_env="/tmp/kube-env.yaml" local -r tmp_kube_env="/tmp/kube-env.yaml"
...@@ -46,11 +26,7 @@ function download-kube-env { ...@@ -46,11 +26,7 @@ function download-kube-env {
-o "${tmp_kube_env}" \ -o "${tmp_kube_env}" \
http://metadata.google.internal/computeMetadata/v1/instance/attributes/kube-env http://metadata.google.internal/computeMetadata/v1/instance/attributes/kube-env
# Convert the yaml format file into a shell-style file. # Convert the yaml format file into a shell-style file.
eval $(python -c ''' sed 's/: /=/' < "${tmp_kube_env}" > "${KUBE_HOME}/kube-env"
import pipes,sys,yaml
for k,v in yaml.load(sys.stdin).iteritems():
print("readonly {var}={value}".format(var = k, value = pipes.quote(str(v))))
''' < "${tmp_kube_env}" > "${KUBE_HOME}/kube-env")
rm -f "${tmp_kube_env}" rm -f "${tmp_kube_env}"
} }
...@@ -65,6 +41,7 @@ function validate-hash { ...@@ -65,6 +41,7 @@ function validate-hash {
fi fi
} }
# Retry a download until we get it. Takes a hash and a set of URLs. # Retry a download until we get it. Takes a hash and a set of URLs.
# #
# $1 is the sha1 of the URL. Can be "" if the sha1 is unknown. # $1 is the sha1 of the URL. Can be "" if the sha1 is unknown.
...@@ -98,24 +75,8 @@ function split-commas { ...@@ -98,24 +75,8 @@ function split-commas {
echo $1 | tr "," "\n" echo $1 | tr "," "\n"
} }
function install-gci-mounter-tools {
local -r rkt_version="v1.18.0"
local -r gci_mounter_version="v2"
local -r rkt_binary_sha1="75fc8f29c79bc9e505f3e7f6e8fadf2425c21967"
local -r rkt_stage1_fly_sha1="474df5a1f934960ba669b360ab713d0a54283091"
local -r gci_mounter_sha1="851e841d8640d6a05e64e22c493f5ac3c4cba561"
download-or-bust "${rkt_binary_sha1}" "https://storage.googleapis.com/kubernetes-release/rkt/${rkt_version}/rkt"
download-or-bust "${rkt_stage1_fly_sha1}" "https://storage.googleapis.com/kubernetes-release/rkt/${rkt_version}/stage1-fly.aci"
download-or-bust "${gci_mounter_sha1}" "https://storage.googleapis.com/kubernetes-release/gci-mounter/gci-mounter-${gci_mounter_version}.aci"
local -r rkt_dst="${KUBE_HOME}/bin/"
mv "${KUBE_HOME}/rkt" "${rkt_dst}/rkt"
mv "${KUBE_HOME}/stage1-fly.aci" "${rkt_dst}/stage1-fly.aci"
mv "${KUBE_HOME}/gci-mounter-${gci_mounter_version}.aci" "${rkt_dst}/gci-mounter-${gci_mounter_version}.aci"
chmod a+x "${rkt_dst}/rkt"
}
# Downloads kubernetes binaries and kube-system manifest tarball, unpacks them, # Downloads kubernetes binaries and kube-system manifest tarball, unpacks them,
# and places them into suitable directories. Files are placed in /home/kubernetes. # and places them into suitable directories. Files are placed in /opt/kubernetes.
function install-kube-binary-config { function install-kube-binary-config {
cd "${KUBE_HOME}" cd "${KUBE_HOME}"
local -r server_binary_tar_urls=( $(split-commas "${SERVER_BINARY_TAR_URL}") ) local -r server_binary_tar_urls=( $(split-commas "${SERVER_BINARY_TAR_URL}") )
...@@ -186,14 +147,9 @@ function install-kube-binary-config { ...@@ -186,14 +147,9 @@ function install-kube-binary-config {
find "${dst_dir}" -name \*.manifest -or -name \*.json | \ find "${dst_dir}" -name \*.manifest -or -name \*.json | \
xargs sed -ri "s@(image\":\s+\")gcr.io/google_containers@\1${kube_addon_registry}@" xargs sed -ri "s@(image\":\s+\")gcr.io/google_containers@\1${kube_addon_registry}@"
fi fi
cp "${dst_dir}/kubernetes/gci-trusty/gci-configure-helper.sh" "${KUBE_HOME}/bin/configure-helper.sh" cp "${dst_dir}/kubernetes/gci-trusty/coreos-configure-helper.sh" "${KUBE_HOME}/bin/configure-helper.sh"
cp "${dst_dir}/kubernetes/gci-trusty/gci-mounter" "${KUBE_HOME}/bin/mounter"
cp "${dst_dir}/kubernetes/gci-trusty/health-monitor.sh" "${KUBE_HOME}/bin/health-monitor.sh"
chmod -R 755 "${kube_bin}" chmod -R 755 "${kube_bin}"
# Install gci mounter related artifacts to allow mounting storage volumes in GCI
install-gci-mounter-tools
# Clean up. # Clean up.
rm -rf "${KUBE_HOME}/kubernetes" rm -rf "${KUBE_HOME}/kubernetes"
rm -f "${KUBE_HOME}/${server_binary_tar}" rm -f "${KUBE_HOME}/${server_binary_tar}"
...@@ -204,10 +160,17 @@ function install-kube-binary-config { ...@@ -204,10 +160,17 @@ function install-kube-binary-config {
######### Main Function ########## ######### Main Function ##########
echo "Start to install kubernetes files" echo "Start to install kubernetes files"
set-broken-motd KUBE_HOME="/opt/kubernetes"
KUBE_HOME="/home/kubernetes" mkdir -p "${KUBE_HOME}"
download-kube-env download-kube-env
source "${KUBE_HOME}/kube-env" source "${KUBE_HOME}/kube-env"
install-kube-binary-config install-kube-binary-config
echo "Done for installing kubernetes files" echo "Done for installing kubernetes files"
# On CoreOS, the hosts is in /usr/share/baselayout/hosts
# So we need to manually populdate the hosts file here on gce.
echo "127.0.0.1 localhost" >> /etc/hosts
echo "::1 localhost" >> /etc/hosts
echo "Configuring hostname"
hostnamectl set-hostname $(hostname | cut -f1 -d.)
...@@ -14,19 +14,6 @@ ...@@ -14,19 +14,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# A library of helper functions and constant for GCI distro # A library of helper functions and constants for the CoreOS distro
# Creates the GCI specific metadata files if they do not exit. # This file intentionally left blank
# Assumed var
# KUBE_TEMP
function ensure-gci-metadata-files {
if [[ ! -f "${KUBE_TEMP}/gci-update.txt" ]]; then
echo -n "update_disabled" > "${KUBE_TEMP}/gci-update.txt"
fi
if [[ ! -f "${KUBE_TEMP}/gci-ensure-gke-docker.txt" ]]; then
echo -n "true" > "${KUBE_TEMP}/gci-ensure-gke-docker.txt"
fi
if [[ ! -f "${KUBE_TEMP}/gci-docker-version.txt" ]]; then
echo -n "${GCI_DOCKER_VERSION:-}" > "${KUBE_TEMP}/gci-docker-version.txt"
fi
}
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# A library of helper functions and constant for GCI distro # A library of helper functions and constant for coreos os distro
source "${KUBE_ROOT}/cluster/gce/gci/helper.sh" source "${KUBE_ROOT}/cluster/gce/coreos/helper.sh"
# create-master-instance creates the master instance. If called with # create-master-instance creates the master instance. If called with
# an argument, the argument is used as the name to a reserved IP # an argument, the argument is used as the name to a reserved IP
...@@ -35,7 +35,6 @@ function create-master-instance { ...@@ -35,7 +35,6 @@ function create-master-instance {
[[ -n ${1:-} ]] && address_opt="--address ${1}" [[ -n ${1:-} ]] && address_opt="--address ${1}"
write-master-env write-master-env
ensure-gci-metadata-files
create-master-instance-internal "${MASTER_NAME}" "${address_opt}" create-master-instance-internal "${MASTER_NAME}" "${address_opt}"
} }
...@@ -60,9 +59,6 @@ function replicate-master-instance() { ...@@ -60,9 +59,6 @@ function replicate-master-instance() {
echo "${kube_env}" > ${KUBE_TEMP}/master-kube-env.yaml echo "${kube_env}" > ${KUBE_TEMP}/master-kube-env.yaml
get-metadata "${existing_master_zone}" "${existing_master_name}" cluster-name > "${KUBE_TEMP}/cluster-name.txt" get-metadata "${existing_master_zone}" "${existing_master_name}" cluster-name > "${KUBE_TEMP}/cluster-name.txt"
get-metadata "${existing_master_zone}" "${existing_master_name}" gci-update-strategy > "${KUBE_TEMP}/gci-update.txt"
get-metadata "${existing_master_zone}" "${existing_master_name}" gci-ensure-gke-docker > "${KUBE_TEMP}/gci-ensure-gke-docker.txt"
get-metadata "${existing_master_zone}" "${existing_master_name}" gci-docker-version > "${KUBE_TEMP}/gci-docker-version.txt"
create-master-instance-internal "${REPLICA_NAME}" create-master-instance-internal "${REPLICA_NAME}"
} }
...@@ -89,9 +85,9 @@ function create-master-instance-internal() { ...@@ -89,9 +85,9 @@ function create-master-instance-internal() {
--scopes "storage-ro,compute-rw,monitoring,logging-write" \ --scopes "storage-ro,compute-rw,monitoring,logging-write" \
--can-ip-forward \ --can-ip-forward \
--metadata-from-file \ --metadata-from-file \
"kube-env=${KUBE_TEMP}/master-kube-env.yaml,user-data=${KUBE_ROOT}/cluster/gce/gci/master.yaml,configure-sh=${KUBE_ROOT}/cluster/gce/gci/configure.sh,cluster-name=${KUBE_TEMP}/cluster-name.txt,gci-update-strategy=${KUBE_TEMP}/gci-update.txt,gci-ensure-gke-docker=${KUBE_TEMP}/gci-ensure-gke-docker.txt,gci-docker-version=${KUBE_TEMP}/gci-docker-version.txt" \ "kube-env=${KUBE_TEMP}/master-kube-env.yaml,user-data=${KUBE_ROOT}/cluster/gce/coreos/master.yaml,configure-sh=${KUBE_ROOT}/cluster/gce/coreos/configure.sh,cluster-name=${KUBE_TEMP}/cluster-name.txt" \
--disk "name=${master_name}-pd,device-name=master-pd,mode=rw,boot=no,auto-delete=no" \ --disk "name=${master_name}-pd,device-name=master-pd,mode=rw,boot=no,auto-delete=no" \
--boot-disk-size "${MASTER_ROOT_DISK_SIZE:-10}" \ --boot-disk-size "${MASTER_ROOT_DISK_SIZE:-30}" \
${preemptible_master} ${preemptible_master}
} }
......
#cloud-config #cloud-config
write_files: coreos:
- path: /etc/systemd/system/kube-master-installation.service update:
permissions: 0644 reboot-strategy: off
owner: root units:
content: | - name: locksmithd.service
[Unit] mask: true
Description=Download and install k8s binaries and configurations - name: kube-master-installation.service
After=network-online.target command: start
content: |
[Service] [Unit]
Type=oneshot Description=Download and install k8s binaries and configurations
RemainAfterExit=yes After=network-online.target
ExecStartPre=/bin/mkdir -p /home/kubernetes/bin
ExecStartPre=/bin/mount --bind /home/kubernetes/bin /home/kubernetes/bin [Service]
ExecStartPre=/bin/mount -o remount,exec /home/kubernetes/bin Type=oneshot
ExecStartPre=/usr/bin/curl --fail --retry 5 --retry-delay 3 --silent --show-error -H "X-Google-Metadata-Request: True" -o /home/kubernetes/bin/configure.sh http://metadata.google.internal/computeMetadata/v1/instance/attributes/configure-sh RemainAfterExit=yes
ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/configure.sh ExecStartPre=/bin/mkdir -p /opt/kubernetes/bin
ExecStart=/home/kubernetes/bin/configure.sh ExecStartPre=/usr/bin/curl --fail --retry 5 --retry-delay 3 --silent --show-error -H "X-Google-Metadata-Request: True" -o /opt/kubernetes/bin/configure.sh http://metadata.google.internal/computeMetadata/v1/instance/attributes/configure-sh
ExecStartPre=/bin/chmod 544 /opt/kubernetes/bin/configure.sh
[Install] ExecStart=/opt/kubernetes/bin/configure.sh
WantedBy=kubernetes.target
[Install]
- path: /etc/systemd/system/kube-master-configuration.service WantedBy=kubernetes.target
permissions: 0644 - name: kube-master-configuration.service
owner: root command: start
content: | content: |
[Unit] [Unit]
Description=Configure kubernetes master Description=Configure kubernetes master
After=kube-master-installation.service After=kube-master-installation.service
[Service] [Service]
Type=oneshot Type=oneshot
RemainAfterExit=yes RemainAfterExit=yes
ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/configure-helper.sh ExecStartPre=/bin/chmod 544 /opt/kubernetes/bin/configure-helper.sh
ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/mounter ExecStart=/opt/kubernetes/bin/configure-helper.sh
ExecStart=/home/kubernetes/bin/configure-helper.sh
[Install]
[Install] WantedBy=kubernetes.target
WantedBy=kubernetes.target - name: kubernetes.target
enable: true
- path: /etc/systemd/system/kube-docker-monitor.service command: start
permissions: 0644 content: |
owner: root [Unit]
content: | Description=Kubernetes
[Unit]
Description=Kubernetes health monitoring for docker [Install]
After=kube-master-configuration.service WantedBy=multi-user.target
- name: docker.service
[Service] drop-ins:
Restart=always - name: "use-cgroupfs-driver.conf"
RestartSec=10 # This is required for setting cgroup parent in the current ~1.4 per-pod cgroup impl
RemainAfterExit=yes content: |
RemainAfterExit=yes [Service]
ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/health-monitor.sh Environment="DOCKER_CGROUPS=--exec-opt native.cgroupdriver="
ExecStart=/home/kubernetes/bin/health-monitor.sh docker
[Install]
WantedBy=kubernetes.target
- path: /etc/systemd/system/kubelet-monitor.service
permissions: 0644
owner: root
content: |
[Unit]
Description=Kubernetes health monitoring for kubelet
After=kube-master-configuration.service
[Service]
Restart=always
RestartSec=10
RemainAfterExit=yes
RemainAfterExit=yes
ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/health-monitor.sh
ExecStart=/home/kubernetes/bin/health-monitor.sh kubelet
[Install]
WantedBy=kubernetes.target
- path: /etc/systemd/system/kube-logrotate.timer
permissions: 0644
owner: root
content: |
[Unit]
Description=Hourly kube-logrotate invocation
[Timer]
OnCalendar=hourly
[Install]
WantedBy=kubernetes.target
- path: /etc/systemd/system/kube-logrotate.service
permissions: 0644
owner: root
content: |
[Unit]
Description=Kubernetes log rotation
After=kube-master-configuration.service
[Service]
Type=oneshot
ExecStart=-/usr/sbin/logrotate /etc/logrotate.conf
[Install]
WantedBy=kubernetes.target
- path: /etc/systemd/system/kubernetes.target
permissions: 0644
owner: root
content: |
[Unit]
Description=Kubernetes
runcmd:
- systemctl daemon-reload
- systemctl enable kube-master-installation.service
- systemctl enable kube-master-configuration.service
- systemctl enable kube-docker-monitor.service
- systemctl enable kubelet-monitor.service
- systemctl enable kube-logrotate.timer
- systemctl enable kube-logrotate.service
- systemctl start kubernetes.target
...@@ -14,19 +14,17 @@ ...@@ -14,19 +14,17 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# A library of helper functions and constant for GCI distro # A library of helper functions and constant for the CoreOS distro
source "${KUBE_ROOT}/cluster/gce/gci/helper.sh" source "${KUBE_ROOT}/cluster/gce/coreos/helper.sh"
# $1: template name (required). # $1: template name (required).
function create-node-instance-template { function create-node-instance-template {
local template_name="$1" local template_name="$1"
ensure-gci-metadata-files
create-node-template "$template_name" "${scope_flags[*]}" \ create-node-template "$template_name" "${scope_flags[*]}" \
"kube-env=${KUBE_TEMP}/node-kube-env.yaml" \ "kube-env=${KUBE_TEMP}/node-kube-env.yaml" \
"user-data=${KUBE_ROOT}/cluster/gce/gci/node.yaml" \ "user-data=${KUBE_ROOT}/cluster/gce/coreos/node.yaml" \
"configure-sh=${KUBE_ROOT}/cluster/gce/gci/configure.sh" \ "configure-sh=${KUBE_ROOT}/cluster/gce/coreos/configure.sh" \
"cluster-name=${KUBE_TEMP}/cluster-name.txt" \ "cluster-name=${KUBE_TEMP}/cluster-name.txt"
"gci-update-strategy=${KUBE_TEMP}/gci-update.txt" \ # TODO(euank): We should include update-strategy here. We should also switch to ignition
"gci-ensure-gke-docker=${KUBE_TEMP}/gci-ensure-gke-docker.txt" \
"gci-docker-version=${KUBE_TEMP}/gci-docker-version.txt"
} }
#cloud-config #cloud-config
write_files: coreos:
- path: /etc/systemd/system/kube-node-installation.service update:
permissions: 0644 reboot-strategy: off
owner: root units:
content: | - name: locksmithd.service
[Unit] mask: true
Description=Download and install k8s binaries and configurations - name: kube-node-installation.service
After=network-online.target command: start
content: |
[Service] [Unit]
Type=oneshot Description=Download and install k8s binaries and configurations
RemainAfterExit=yes After=network-online.target
ExecStartPre=/bin/mkdir -p /home/kubernetes/bin
ExecStartPre=/bin/mount --bind /home/kubernetes/bin /home/kubernetes/bin [Service]
ExecStartPre=/bin/mount -o remount,exec /home/kubernetes/bin Type=oneshot
ExecStartPre=/usr/bin/curl --fail --retry 5 --retry-delay 3 --silent --show-error -H "X-Google-Metadata-Request: True" -o /home/kubernetes/bin/configure.sh http://metadata.google.internal/computeMetadata/v1/instance/attributes/configure-sh RemainAfterExit=yes
ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/configure.sh ExecStartPre=/bin/mkdir -p /opt/kubernetes/bin
ExecStart=/home/kubernetes/bin/configure.sh ExecStartPre=/usr/bin/curl --fail --retry 5 --retry-delay 3 --silent --show-error -H "X-Google-Metadata-Request: True" -o /opt/kubernetes/bin/configure.sh http://metadata.google.internal/computeMetadata/v1/instance/attributes/configure-sh
ExecStartPre=/bin/chmod 544 /opt/kubernetes/bin/configure.sh
[Install] ExecStart=/opt/kubernetes/bin/configure.sh
WantedBy=kubernetes.target
[Install]
- path: /etc/systemd/system/kube-node-configuration.service WantedBy=kubernetes.target
permissions: 0644 - name: kube-node-configuration.service
owner: root command: start
content: | content: |
[Unit] [Unit]
Description=Configure kubernetes node Description=Configure kubernetes master
After=kube-node-installation.service After=kube-node-installation.service
[Service] [Service]
Type=oneshot Type=oneshot
RemainAfterExit=yes RemainAfterExit=yes
ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/configure-helper.sh ExecStartPre=/bin/chmod 544 /opt/kubernetes/bin/configure-helper.sh
ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/mounter ExecStart=/opt/kubernetes/bin/configure-helper.sh
ExecStart=/home/kubernetes/bin/configure-helper.sh
[Install]
[Install] WantedBy=kubernetes.target
WantedBy=kubernetes.target - name: kubernetes.target
enable: true
- path: /etc/systemd/system/kube-docker-monitor.service command: start
permissions: 0644 content: |
owner: root [Unit]
content: | Description=Kubernetes
[Unit]
Description=Kubernetes health monitoring for docker [Install]
After=kube-node-configuration.service WantedBy=multi-user.target
- name: docker.service
[Service] drop-ins:
Restart=always - name: "use-cgroupfs-driver.conf"
RestartSec=10 # This is required for setting cgroup parent in the current ~1.4 per-pod cgroup impl
RemainAfterExit=yes content: |
RemainAfterExit=yes [Service]
ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/health-monitor.sh Environment="DOCKER_CGROUPS=--exec-opt native.cgroupdriver="
ExecStart=/home/kubernetes/bin/health-monitor.sh docker
[Install]
WantedBy=kubernetes.target
- path: /etc/systemd/system/kubelet-monitor.service
permissions: 0644
owner: root
content: |
[Unit]
Description=Kubernetes health monitoring for kubelet
After=kube-node-configuration.service
[Service]
Restart=always
RestartSec=10
RemainAfterExit=yes
RemainAfterExit=yes
ExecStartPre=/bin/chmod 544 /home/kubernetes/bin/health-monitor.sh
ExecStart=/home/kubernetes/bin/health-monitor.sh kubelet
[Install]
WantedBy=kubernetes.target
- path: /etc/systemd/system/kube-logrotate.timer
permissions: 0644
owner: root
content: |
[Unit]
Description=Hourly kube-logrotate invocation
[Timer]
OnCalendar=hourly
[Install]
WantedBy=kubernetes.target
- path: /etc/systemd/system/kube-logrotate.service
permissions: 0644
owner: root
content: |
[Unit]
Description=Kubernetes log rotation
After=kube-node-configuration.service
[Service]
Type=oneshot
ExecStart=-/usr/sbin/logrotate /etc/logrotate.conf
[Install]
WantedBy=kubernetes.target
- path: /etc/systemd/system/kubernetes.target
permissions: 0644
owner: root
content: |
[Unit]
Description=Kubernetes
runcmd:
- systemctl daemon-reload
- systemctl enable kube-node-installation.service
- systemctl enable kube-node-configuration.service
- systemctl enable kube-docker-monitor.service
- systemctl enable kubelet-monitor.service
- systemctl enable kube-logrotate.timer
- systemctl enable kube-logrotate.service
- systemctl start kubernetes.target
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment