Use kubelet system container on fedora-atomic

* Use the upstream hyperkube image packaged with the
required metadata to be usable as a system container
under systemd
* Fix port-forward since socat is included
This commit is contained in:
Dalton Hubble 2018-04-07 00:47:33 -07:00
parent 8d7cfc1a45
commit 19bc5aea9e
6 changed files with 67 additions and 146 deletions

View File

@ -18,13 +18,11 @@ write_files:
ETCD_PEER_CERT_FILE=/etc/ssl/certs/etcd/peer.crt ETCD_PEER_CERT_FILE=/etc/ssl/certs/etcd/peer.crt
ETCD_PEER_KEY_FILE=/etc/ssl/certs/etcd/peer.key ETCD_PEER_KEY_FILE=/etc/ssl/certs/etcd/peer.key
ETCD_PEER_CLIENT_CERT_AUTH=true ETCD_PEER_CLIENT_CERT_AUTH=true
- path: /etc/systemd/system/kubelet.service - path: /etc/systemd/system/kubelet.service.d/10-typhoon.conf
content: | content: |
[Unit] [Unit]
Description=Kubelet
Wants=rpc-statd.service Wants=rpc-statd.service
[Service] [Service]
WorkingDirectory=/etc/kubernetes
ExecStartPre=/bin/mkdir -p /opt/cni/bin ExecStartPre=/bin/mkdir -p /opt/cni/bin
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
@ -33,14 +31,12 @@ write_files:
ExecStartPre=/bin/mkdir -p /var/lib/cni ExecStartPre=/bin/mkdir -p /var/lib/cni
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt" ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt"
# Atomic's system containers and RPMs are old and unfriendly. Use this. Restart=always
ExecStartPre=/usr/bin/curl -L https://dl.k8s.io/v1.10.0/kubernetes-node-linux-amd64.tar.gz -o kubernetes-node-linux-amd64.tar.gz RestartSec=10
ExecStartPre=/usr/bin/tar xzf kubernetes-node-linux-amd64.tar.gz -C /usr/local/bin --strip-components=3 kubernetes/node/bin/kubelet - path: /etc/kubernetes/kubelet.conf
ExecStart= content: |
ExecStart=/usr/local/bin/kubelet \ ARGS="--allow-privileged \
--allow-privileged \
--anonymous-auth=false \ --anonymous-auth=false \
--cgroup-driver=systemd \
--client-ca-file=/etc/kubernetes/ca.crt \ --client-ca-file=/etc/kubernetes/ca.crt \
--cluster_dns=${k8s_dns_service_ip} \ --cluster_dns=${k8s_dns_service_ip} \
--cluster_domain=${cluster_domain_suffix} \ --cluster_domain=${cluster_domain_suffix} \
@ -53,19 +49,11 @@ write_files:
--node-labels=node-role.kubernetes.io/controller="true" \ --node-labels=node-role.kubernetes.io/controller="true" \
--pod-manifest-path=/etc/kubernetes/manifests \ --pod-manifest-path=/etc/kubernetes/manifests \
--register-with-taints=node-role.kubernetes.io/master=:NoSchedule \ --register-with-taints=node-role.kubernetes.io/master=:NoSchedule \
--volume-plugin-dir=/var/lib/kubelet/volumeplugins --volume-plugin-dir=/var/lib/kubelet/volumeplugins"
Restart=always - path: /etc/kubernetes/kubeconfig
RestartSec=10 permissions: '0644'
[Install]
WantedBy=multi-user.target
- path: /etc/systemd/system/kubelet.path
content: | content: |
[Unit] ${kubeconfig}
Description=Watch for kubeconfig
[Path]
PathExists=/etc/kubernetes/kubeconfig
[Install]
WantedBy=multi-user.target
- path: /etc/systemd/system/bootkube.service - path: /etc/systemd/system/bootkube.service
content: | content: |
[Unit] [Unit]
@ -80,17 +68,6 @@ write_files:
ExecStartPost=/bin/touch /var/bootkube/init_bootkube.done ExecStartPost=/bin/touch /var/bootkube/init_bootkube.done
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
- path: /etc/kubernetes/.keep
- path: /etc/kubernetes/kubeconfig
permissions: '0644'
content: |
${kubeconfig}
- path: /etc/selinux/config
owner: root:root
permissions: '0644'
content: |
SELINUX=permissive
SELINUXTYPE=targeted
- path: /var/bootkube/.keep - path: /var/bootkube/.keep
- path: /usr/local/bin/bootkube-start - path: /usr/local/bin/bootkube-start
permissions: '0755' permissions: '0755'
@ -104,13 +81,19 @@ write_files:
--volume /var/bootkube/assets:/assets:Z \ --volume /var/bootkube/assets:/assets:Z \
--entrypoint=/bootkube \ --entrypoint=/bootkube \
quay.io/coreos/bootkube:v0.11.0 start --asset-dir=/assets quay.io/coreos/bootkube:v0.11.0 start --asset-dir=/assets
- path: /etc/selinux/config
owner: root:root
permissions: '0644'
content: |
SELINUX=permissive
SELINUXTYPE=targeted
bootcmd: bootcmd:
- [setenforce, Permissive] - [setenforce, Permissive]
runcmd: runcmd:
- [systemctl, daemon-reload] - [systemctl, daemon-reload]
- "atomic install --system --name=etcd quay.io/dghubble/etcd:99f87f9245ef2b2104fe2fc3550c21327b5a980f" - "atomic install --system --name=etcd quay.io/dghubble/etcd:99f87f9245ef2b2104fe2fc3550c21327b5a980f"
- [systemctl, start, --no-block, etcd.service] - [systemctl, start, --no-block, etcd.service]
- [systemctl, enable, kubelet.service] - "atomic install --system --name=kubelet quay.io/dghubble/hyper:f384aae1ffb04fbe303ee55d1fa3c09bc72bf146"
- [systemctl, start, --no-block, kubelet.service] - [systemctl, start, --no-block, kubelet.service]
- [systemctl, disable, firewalld, --now] - [systemctl, disable, firewalld, --now]
users: users:

View File

@ -1,28 +1,22 @@
#cloud-config #cloud-config
write_files: write_files:
- path: /etc/systemd/system/kubelet.service - path: /etc/systemd/system/kubelet.service.d/10-typhoon.conf
content: | content: |
[Unit] [Unit]
Description=Kubelet
Wants=rpc-statd.service Wants=rpc-statd.service
[Service] [Service]
WorkingDirectory=/etc/kubernetes
ExecStartPre=/bin/mkdir -p /opt/cni/bin ExecStartPre=/bin/mkdir -p /opt/cni/bin
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
ExecStartPre=/bin/mkdir -p /etc/kubernetes/checkpoint-secrets
ExecStartPre=/bin/mkdir -p /etc/kubernetes/inactive-manifests
ExecStartPre=/bin/mkdir -p /var/lib/cni ExecStartPre=/bin/mkdir -p /var/lib/cni
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt" ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt"
# Atomic's system containers and RPMs are old and unfriendly. Use this. Restart=always
ExecStartPre=/usr/bin/curl -L https://dl.k8s.io/v1.10.0/kubernetes-node-linux-amd64.tar.gz -o kubernetes-node-linux-amd64.tar.gz RestartSec=10
ExecStartPre=/usr/bin/tar xzf kubernetes-node-linux-amd64.tar.gz -C /usr/local/bin --strip-components=3 kubernetes/node/bin/kubelet - path: /etc/kubernetes/kubelet.conf
ExecStart= content: |
ExecStart=/usr/local/bin/kubelet \ ARGS="--allow-privileged \
--allow-privileged \
--anonymous-auth=false \ --anonymous-auth=false \
--cgroup-driver=systemd \
--client-ca-file=/etc/kubernetes/ca.crt \ --client-ca-file=/etc/kubernetes/ca.crt \
--cluster_dns=${k8s_dns_service_ip} \ --cluster_dns=${k8s_dns_service_ip} \
--cluster_domain=${cluster_domain_suffix} \ --cluster_domain=${cluster_domain_suffix} \
@ -33,20 +27,7 @@ write_files:
--network-plugin=cni \ --network-plugin=cni \
--node-labels=node-role.kubernetes.io/node \ --node-labels=node-role.kubernetes.io/node \
--pod-manifest-path=/etc/kubernetes/manifests \ --pod-manifest-path=/etc/kubernetes/manifests \
--volume-plugin-dir=/var/lib/kubelet/volumeplugins --volume-plugin-dir=/var/lib/kubelet/volumeplugins"
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
- path: /etc/systemd/system/kubelet.path
content: |
[Unit]
Description=Watch for kubeconfig
[Path]
PathExists=/etc/kubernetes/kubeconfig
[Install]
WantedBy=multi-user.target
- path: /etc/kubernetes/.keep
- path: /etc/kubernetes/kubeconfig - path: /etc/kubernetes/kubeconfig
permissions: '0644' permissions: '0644'
content: | content: |
@ -60,9 +41,10 @@ write_files:
bootcmd: bootcmd:
- [setenforce, Permissive] - [setenforce, Permissive]
runcmd: runcmd:
- [systemctl, daemon-reload] - systemctl daemon-reload
- [systemctl, disable, firewalld, --now] - "atomic install --system --name=kubelet quay.io/dghubble/hyper:f384aae1ffb04fbe303ee55d1fa3c09bc72bf146"
- [systemctl, enable, kubelet.service, --now] - systemctl start --no-block kubelet.service
- systemctl disable firewalld --now
users: users:
- default - default
- name: fedora - name: fedora

View File

@ -18,13 +18,11 @@ write_files:
ETCD_PEER_CERT_FILE=/etc/ssl/certs/etcd/peer.crt ETCD_PEER_CERT_FILE=/etc/ssl/certs/etcd/peer.crt
ETCD_PEER_KEY_FILE=/etc/ssl/certs/etcd/peer.key ETCD_PEER_KEY_FILE=/etc/ssl/certs/etcd/peer.key
ETCD_PEER_CLIENT_CERT_AUTH=true ETCD_PEER_CLIENT_CERT_AUTH=true
- path: /etc/systemd/system/kubelet.service - path: /etc/systemd/system/kubelet.service.d/10-typhoon.conf
content: | content: |
[Unit] [Unit]
Description=Kubelet
Wants=rpc-statd.service Wants=rpc-statd.service
[Service] [Service]
WorkingDirectory=/etc/kubernetes
ExecStartPre=/bin/mkdir -p /opt/cni/bin ExecStartPre=/bin/mkdir -p /opt/cni/bin
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
@ -33,14 +31,12 @@ write_files:
ExecStartPre=/bin/mkdir -p /var/lib/cni ExecStartPre=/bin/mkdir -p /var/lib/cni
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt" ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt"
# Atomic's system containers and RPMs are old and unfriendly. Use this. Restart=always
ExecStartPre=/usr/bin/curl -L https://dl.k8s.io/v1.10.0/kubernetes-node-linux-amd64.tar.gz -o kubernetes-node-linux-amd64.tar.gz RestartSec=10
ExecStartPre=/usr/bin/tar xzf kubernetes-node-linux-amd64.tar.gz -C /usr/local/bin --strip-components=3 kubernetes/node/bin/kubelet - path: /etc/kubernetes/kubelet.conf
ExecStart= content: |
ExecStart=/usr/local/bin/kubelet \ ARGS="--allow-privileged \
--allow-privileged \
--anonymous-auth=false \ --anonymous-auth=false \
--cgroup-driver=systemd \
--client-ca-file=/etc/kubernetes/ca.crt \ --client-ca-file=/etc/kubernetes/ca.crt \
--cluster_dns=${k8s_dns_service_ip} \ --cluster_dns=${k8s_dns_service_ip} \
--cluster_domain=${cluster_domain_suffix} \ --cluster_domain=${cluster_domain_suffix} \
@ -54,11 +50,7 @@ write_files:
--node-labels=node-role.kubernetes.io/controller="true" \ --node-labels=node-role.kubernetes.io/controller="true" \
--pod-manifest-path=/etc/kubernetes/manifests \ --pod-manifest-path=/etc/kubernetes/manifests \
--register-with-taints=node-role.kubernetes.io/master=:NoSchedule \ --register-with-taints=node-role.kubernetes.io/master=:NoSchedule \
--volume-plugin-dir=/var/lib/kubelet/volumeplugins --volume-plugin-dir=/var/lib/kubelet/volumeplugins"
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
- path: /etc/systemd/system/kubelet.path - path: /etc/systemd/system/kubelet.path
content: | content: |
[Unit] [Unit]
@ -81,7 +73,6 @@ write_files:
ExecStartPost=/bin/touch /var/bootkube/init_bootkube.done ExecStartPost=/bin/touch /var/bootkube/init_bootkube.done
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
- path: /etc/kubernetes/.keep
- path: /var/bootkube/.keep - path: /var/bootkube/.keep
- path: /etc/selinux/config - path: /etc/selinux/config
owner: root:root owner: root:root
@ -108,6 +99,7 @@ runcmd:
- "atomic install --system --name=etcd quay.io/dghubble/etcd:99f87f9245ef2b2104fe2fc3550c21327b5a980f" - "atomic install --system --name=etcd quay.io/dghubble/etcd:99f87f9245ef2b2104fe2fc3550c21327b5a980f"
- [systemctl, start, --no-block, etcd.service] - [systemctl, start, --no-block, etcd.service]
- [hostnamectl, set-hostname, ${domain_name}] - [hostnamectl, set-hostname, ${domain_name}]
- "atomic install --system --name=kubelet quay.io/dghubble/hyper:f384aae1ffb04fbe303ee55d1fa3c09bc72bf146"
- [systemctl, enable, kubelet.path] - [systemctl, enable, kubelet.path]
- [systemctl, start, --no-block, kubelet.path] - [systemctl, start, --no-block, kubelet.path]
- [systemctl, disable, firewalld, --now] - [systemctl, disable, firewalld, --now]

View File

@ -1,28 +1,22 @@
#cloud-config #cloud-config
write_files: write_files:
- path: /etc/systemd/system/kubelet.service - path: /etc/systemd/system/kubelet.service.d/10-typhoon.conf
content: | content: |
[Unit] [Unit]
Description=Kubelet
Wants=rpc-statd.service Wants=rpc-statd.service
[Service] [Service]
WorkingDirectory=/etc/kubernetes
ExecStartPre=/bin/mkdir -p /opt/cni/bin ExecStartPre=/bin/mkdir -p /opt/cni/bin
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
ExecStartPre=/bin/mkdir -p /etc/kubernetes/checkpoint-secrets
ExecStartPre=/bin/mkdir -p /etc/kubernetes/inactive-manifests
ExecStartPre=/bin/mkdir -p /var/lib/cni ExecStartPre=/bin/mkdir -p /var/lib/cni
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt" ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt"
# Atomic's system containers and RPMs are old and unfriendly. Use this. Restart=always
ExecStartPre=/usr/bin/curl -L https://dl.k8s.io/v1.10.0/kubernetes-node-linux-amd64.tar.gz -o kubernetes-node-linux-amd64.tar.gz RestartSec=10
ExecStartPre=/usr/bin/tar xzf kubernetes-node-linux-amd64.tar.gz -C /usr/local/bin --strip-components=3 kubernetes/node/bin/kubelet - path: /etc/kubernetes/kubelet.conf
ExecStart= content: |
ExecStart=/usr/local/bin/kubelet \ ARGS="--allow-privileged \
--allow-privileged \
--anonymous-auth=false \ --anonymous-auth=false \
--cgroup-driver=systemd \
--client-ca-file=/etc/kubernetes/ca.crt \ --client-ca-file=/etc/kubernetes/ca.crt \
--cluster_dns=${k8s_dns_service_ip} \ --cluster_dns=${k8s_dns_service_ip} \
--cluster_domain=${cluster_domain_suffix} \ --cluster_domain=${cluster_domain_suffix} \
@ -34,11 +28,7 @@ write_files:
--network-plugin=cni \ --network-plugin=cni \
--node-labels=node-role.kubernetes.io/node \ --node-labels=node-role.kubernetes.io/node \
--pod-manifest-path=/etc/kubernetes/manifests \ --pod-manifest-path=/etc/kubernetes/manifests \
--volume-plugin-dir=/var/lib/kubelet/volumeplugins --volume-plugin-dir=/var/lib/kubelet/volumeplugins"
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
- path: /etc/systemd/system/kubelet.path - path: /etc/systemd/system/kubelet.path
content: | content: |
[Unit] [Unit]
@ -47,7 +37,6 @@ write_files:
PathExists=/etc/kubernetes/kubeconfig PathExists=/etc/kubernetes/kubeconfig
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
- path: /etc/kubernetes/.keep
- path: /etc/selinux/config - path: /etc/selinux/config
owner: root:root owner: root:root
permissions: '0644' permissions: '0644'
@ -59,6 +48,7 @@ bootcmd:
runcmd: runcmd:
- [systemctl, daemon-reload] - [systemctl, daemon-reload]
- [hostnamectl, set-hostname, ${domain_name}] - [hostnamectl, set-hostname, ${domain_name}]
- "atomic install --system --name=kubelet quay.io/dghubble/hyper:f384aae1ffb04fbe303ee55d1fa3c09bc72bf146"
- [systemctl, enable, kubelet.path] - [systemctl, enable, kubelet.path]
- [systemctl, start, --no-block, kubelet.path] - [systemctl, start, --no-block, kubelet.path]
- [systemctl, disable, firewalld, --now] - [systemctl, disable, firewalld, --now]

View File

@ -26,23 +26,18 @@ write_files:
Type=oneshot Type=oneshot
Environment=OUTPUT=/run/metadata/digitalocean Environment=OUTPUT=/run/metadata/digitalocean
ExecStart=/usr/bin/mkdir -p /run/metadata ExecStart=/usr/bin/mkdir -p /run/metadata
ExecStart=/usr/bin/bash -c 'echo "DIGITALOCEAN_IPV4_PUBLIC_0=$(curl\ ExecStart=/usr/bin/bash -c 'echo "PRIVATE_IPV4=$(curl\
--url http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address\
--retry 10)\nDIGITALOCEAN_IPV4_PRIVATE_0=$(curl\
--url http://169.254.169.254/metadata/v1/interfaces/private/0/ipv4/address\ --url http://169.254.169.254/metadata/v1/interfaces/private/0/ipv4/address\
--retry 10)" > $${OUTPUT}' --retry 10)" > $${OUTPUT}'
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
- path: /etc/systemd/system/kubelet.service - path: /etc/systemd/system/kubelet.service.d/10-typhoon.conf
content: | content: |
[Unit] [Unit]
Description=Kubelet
Requires=cloud-metadata.service Requires=cloud-metadata.service
After=cloud-metadata.service After=cloud-metadata.service
Wants=rpc-statd.service Wants=rpc-statd.service
[Service] [Service]
WorkingDirectory=/etc/kubernetes
EnvironmentFile=/run/metadata/digitalocean
ExecStartPre=/bin/mkdir -p /opt/cni/bin ExecStartPre=/bin/mkdir -p /opt/cni/bin
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
@ -51,20 +46,17 @@ write_files:
ExecStartPre=/bin/mkdir -p /var/lib/cni ExecStartPre=/bin/mkdir -p /var/lib/cni
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt" ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt"
# Atomic's system containers and RPMs are old and unfriendly. Use this. Restart=always
ExecStartPre=/usr/bin/curl -L https://dl.k8s.io/v1.10.0/kubernetes-node-linux-amd64.tar.gz -o kubernetes-node-linux-amd64.tar.gz RestartSec=10
ExecStartPre=/usr/bin/tar xzf kubernetes-node-linux-amd64.tar.gz -C /usr/local/bin --strip-components=3 kubernetes/node/bin/kubelet - path: /etc/kubernetes/kubelet.conf
ExecStart= content: |
ExecStart=/usr/local/bin/kubelet \ ARGS="--allow-privileged \
--allow-privileged \
--anonymous-auth=false \ --anonymous-auth=false \
--cgroup-driver=systemd \
--client-ca-file=/etc/kubernetes/ca.crt \ --client-ca-file=/etc/kubernetes/ca.crt \
--cluster_dns=${k8s_dns_service_ip} \ --cluster_dns=${k8s_dns_service_ip} \
--cluster_domain=${cluster_domain_suffix} \ --cluster_domain=${cluster_domain_suffix} \
--cni-conf-dir=/etc/kubernetes/cni/net.d \ --cni-conf-dir=/etc/kubernetes/cni/net.d \
--exit-on-lock-contention \ --exit-on-lock-contention \
--hostname-override=$${DIGITALOCEAN_IPV4_PRIVATE_0} \
--kubeconfig=/etc/kubernetes/kubeconfig \ --kubeconfig=/etc/kubernetes/kubeconfig \
--lock-file=/var/run/lock/kubelet.lock \ --lock-file=/var/run/lock/kubelet.lock \
--network-plugin=cni \ --network-plugin=cni \
@ -72,11 +64,7 @@ write_files:
--node-labels=node-role.kubernetes.io/controller="true" \ --node-labels=node-role.kubernetes.io/controller="true" \
--pod-manifest-path=/etc/kubernetes/manifests \ --pod-manifest-path=/etc/kubernetes/manifests \
--register-with-taints=node-role.kubernetes.io/master=:NoSchedule \ --register-with-taints=node-role.kubernetes.io/master=:NoSchedule \
--volume-plugin-dir=/var/lib/kubelet/volumeplugins --volume-plugin-dir=/var/lib/kubelet/volumeplugins"
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
- path: /etc/systemd/system/kubelet.path - path: /etc/systemd/system/kubelet.path
content: | content: |
[Unit] [Unit]
@ -99,7 +87,6 @@ write_files:
ExecStartPost=/bin/touch /var/bootkube/init_bootkube.done ExecStartPost=/bin/touch /var/bootkube/init_bootkube.done
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
- path: /etc/kubernetes/.keep
- path: /var/bootkube/.keep - path: /var/bootkube/.keep
- path: /etc/selinux/config - path: /etc/selinux/config
owner: root:root owner: root:root
@ -126,6 +113,7 @@ runcmd:
- "atomic install --system --name=etcd quay.io/dghubble/etcd:99f87f9245ef2b2104fe2fc3550c21327b5a980f" - "atomic install --system --name=etcd quay.io/dghubble/etcd:99f87f9245ef2b2104fe2fc3550c21327b5a980f"
- [systemctl, start, --no-block, etcd.service] - [systemctl, start, --no-block, etcd.service]
- [systemctl, enable, cloud-metadata.service] - [systemctl, enable, cloud-metadata.service]
- "atomic install --system --name=kubelet quay.io/dghubble/hyper:f384aae1ffb04fbe303ee55d1fa3c09bc72bf146"
- [systemctl, enable, kubelet.path] - [systemctl, enable, kubelet.path]
- [systemctl, start, --no-block, kubelet.path] - [systemctl, start, --no-block, kubelet.path]
- [systemctl, disable, firewalld, --now] - [systemctl, disable, firewalld, --now]

View File

@ -8,55 +8,41 @@ write_files:
Type=oneshot Type=oneshot
Environment=OUTPUT=/run/metadata/digitalocean Environment=OUTPUT=/run/metadata/digitalocean
ExecStart=/usr/bin/mkdir -p /run/metadata ExecStart=/usr/bin/mkdir -p /run/metadata
ExecStart=/usr/bin/bash -c 'echo "DIGITALOCEAN_IPV4_PUBLIC_0=$(curl\ ExecStart=/usr/bin/bash -c 'echo "PRIVATE_IPV4=$(curl\
--url http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address\
--retry 10)\nDIGITALOCEAN_IPV4_PRIVATE_0=$(curl\
--url http://169.254.169.254/metadata/v1/interfaces/private/0/ipv4/address\ --url http://169.254.169.254/metadata/v1/interfaces/private/0/ipv4/address\
--retry 10)" > $${OUTPUT}' --retry 10)" > $${OUTPUT}'
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
- path: /etc/systemd/system/kubelet.service - path: /etc/systemd/system/kubelet.service.d/10-typhoon.conf
content: | content: |
[Unit] [Unit]
Description=Kubelet
Requires=cloud-metadata.service Requires=cloud-metadata.service
After=cloud-metadata.service After=cloud-metadata.service
Wants=rpc-statd.service Wants=rpc-statd.service
[Service] [Service]
WorkingDirectory=/etc/kubernetes
EnvironmentFile=/run/metadata/digitalocean
ExecStartPre=/bin/mkdir -p /opt/cni/bin ExecStartPre=/bin/mkdir -p /opt/cni/bin
ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests ExecStartPre=/bin/mkdir -p /etc/kubernetes/manifests
ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d ExecStartPre=/bin/mkdir -p /etc/kubernetes/cni/net.d
ExecStartPre=/bin/mkdir -p /etc/kubernetes/checkpoint-secrets
ExecStartPre=/bin/mkdir -p /etc/kubernetes/inactive-manifests
ExecStartPre=/bin/mkdir -p /var/lib/cni ExecStartPre=/bin/mkdir -p /var/lib/cni
ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins ExecStartPre=/bin/mkdir -p /var/lib/kubelet/volumeplugins
ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt" ExecStartPre=/usr/bin/bash -c "grep 'certificate-authority-data' /etc/kubernetes/kubeconfig | awk '{print $2}' | base64 -d > /etc/kubernetes/ca.crt"
# Atomic's system containers and RPMs are old and unfriendly. Use this. Restart=always
ExecStartPre=/usr/bin/curl -L https://dl.k8s.io/v1.10.0/kubernetes-node-linux-amd64.tar.gz -o kubernetes-node-linux-amd64.tar.gz RestartSec=10
ExecStartPre=/usr/bin/tar xzf kubernetes-node-linux-amd64.tar.gz -C /usr/local/bin --strip-components=3 kubernetes/node/bin/kubelet - path: /etc/kubernetes/kubelet.conf
ExecStart= content: |
ExecStart=/usr/local/bin/kubelet \ ARGS="--allow-privileged \
--allow-privileged \
--anonymous-auth=false \ --anonymous-auth=false \
--cgroup-driver=systemd \
--client-ca-file=/etc/kubernetes/ca.crt \ --client-ca-file=/etc/kubernetes/ca.crt \
--cluster_dns=${k8s_dns_service_ip} \ --cluster_dns=${k8s_dns_service_ip} \
--cluster_domain=${cluster_domain_suffix} \ --cluster_domain=${cluster_domain_suffix} \
--cni-conf-dir=/etc/kubernetes/cni/net.d \ --cni-conf-dir=/etc/kubernetes/cni/net.d \
--exit-on-lock-contention \ --exit-on-lock-contention \
--hostname-override=$${DIGITALOCEAN_IPV4_PRIVATE_0} \
--kubeconfig=/etc/kubernetes/kubeconfig \ --kubeconfig=/etc/kubernetes/kubeconfig \
--lock-file=/var/run/lock/kubelet.lock \ --lock-file=/var/run/lock/kubelet.lock \
--network-plugin=cni \ --network-plugin=cni \
--node-labels=node-role.kubernetes.io/node \ --node-labels=node-role.kubernetes.io/node \
--pod-manifest-path=/etc/kubernetes/manifests \ --pod-manifest-path=/etc/kubernetes/manifests \
--volume-plugin-dir=/var/lib/kubelet/volumeplugins --volume-plugin-dir=/var/lib/kubelet/volumeplugins"
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
- path: /etc/systemd/system/kubelet.path - path: /etc/systemd/system/kubelet.path
content: | content: |
[Unit] [Unit]
@ -65,7 +51,6 @@ write_files:
PathExists=/etc/kubernetes/kubeconfig PathExists=/etc/kubernetes/kubeconfig
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
- path: /etc/kubernetes/.keep
- path: /etc/selinux/config - path: /etc/selinux/config
owner: root:root owner: root:root
permissions: '0644' permissions: '0644'
@ -75,11 +60,12 @@ write_files:
bootcmd: bootcmd:
- [setenforce, Permissive] - [setenforce, Permissive]
runcmd: runcmd:
- [systemctl, daemon-reload] - systemctl daemon-reload
- [systemctl, enable, kubelet.path] - systemctl enable cloud-metadata.service
- [systemctl, enable, cloud-metadata.service] - "atomic install --system --name=kubelet quay.io/dghubble/hyper:f384aae1ffb04fbe303ee55d1fa3c09bc72bf146"
- [systemctl, start, --no-block, kubelet.path] - systemctl enable kubelet.path
- [systemctl, disable, firewalld, --now] - systemctl start --no-block kubelet.path
- systemctl disable firewalld --now
users: users:
- default - default
- name: fedora - name: fedora