mkdir daemons
cat >daemons/etcd.yml <<EOF
version: '2'
services:
etcd:
image: bestmike007/etcd:v3.2.13
container_name: etcd
restart: always
network_mode: host
volumes:
- /srv/etcd:/${ETCD_NAME}.etcd
- /etc/etcd:/certs:ro
environment:
ETCD_NAME: ${ETCD_NAME}
ETCD_INITIAL_ADVERTISE_PEER_URLS: https://${CURRENT_NODE}:2380
ETCD_LISTEN_PEER_URLS: https://${CURRENT_NODE}:2380
ETCD_ADVERTISE_CLIENT_URLS: https://${CURRENT_NODE}:2379
ETCD_LISTEN_CLIENT_URLS: https://${CURRENT_NODE}:2379,https://127.0.0.1:2379
ETCD_INITIAL_CLUSTER_TOKEN: ${ETCD_INITIAL_CLUSTER_TOKEN}
ETCD_INITIAL_CLUSTER: ${ETCD_INITIAL_CLUSTER}
ETCD_CLIENT_CERT_AUTH: "true"
ETCD_TRUSTED_CA_FILE: /certs/etcd-cs-ca.pem
ETCD_CERT_FILE: /certs/etcd-server.pem
ETCD_KEY_FILE: /certs/etcd-server-key.pem
ETCD_PEER_CLIENT_CERT_AUTH: "true"
ETCD_PEER_TRUSTED_CA_FILE: /certs/etcd-peer-ca.pem
ETCD_PEER_CERT_FILE: /certs/etcd-peer.pem
ETCD_PEER_KEY_FILE: /certs/etcd-peer-key.pem
EOF
cat >daemons/kube-master.yml <<EOF
version: '2'
services:
kube-api:
image: bestmike007/hyperkube:v1.9.1
container_name: kube-api
restart: always
network_mode: host
volumes:
- /etc/kubernetes:/etc/kubernetes:ro
command: "/usr/local/bin/kube-apiserver \
--apiserver-count=3 \
--allow_privileged=true \
--service-cluster-ip-range=${SERVICE_CLUSTER_CIDR} \
--kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname \
--admission-control=ServiceAccount,NamespaceLifecycle,LimitRanger,PersistentVolumeLabel,DefaultStorageClass,ResourceQuota,DefaultTolerationSeconds \
--runtime-config=batch/v2alpha1 \
--runtime-config=authentication.k8s.io/v1beta1=true \
--runtime-config=extensions/v1beta1/podsecuritypolicy=true \
--storage-backend=etcd3 \
--etcd-servers=${ETCD_SERVERS} \
--etcd-cafile=/etc/kubernetes/etcd-cs-ca.pem \
--etcd-certfile=/etc/kubernetes/etcd-client.pem \
--etcd-keyfile=/etc/kubernetes/etcd-client-key.pem \
--client-ca-file=/etc/kubernetes/kube-ca.pem \
--service-account-key-file=/etc/kubernetes/kube-service-account.key \
--tls-ca-file=/etc/kubernetes/kube-ca.pem \
--tls-cert-file=/etc/kubernetes/kube-api.pem \
--tls-private-key-file=/etc/kubernetes/kube-api-key.pem \
--authorization-mode=RBAC \
--kubelet-client-certificate=/etc/kubernetes/kubelet-client-certificate.pem \
--kubelet-client-key=/etc/kubernetes/kubelet-client-certificate-key.pem \
--v=4"
kube-controller:
image: bestmike007/hyperkube:v1.9.1
container_name: kube-controller
restart: always
network_mode: host
volumes:
- /etc/kubernetes:/etc/kubernetes:ro
command: "/usr/local/bin/kube-controller-manager \
--address=0.0.0.0 \
--leader-elect=true \
--kubeconfig=/etc/kubernetes/kubecfg-controller.yml \
--enable-hostpath-provisioner=false \
--node-monitor-grace-period=40s \
--pod-eviction-timeout=5m0s \
--v=2 \
--allocate-node-cidrs=true \
--cluster-cidr=${CLUSTER_CIDR} \
--service-cluster-ip-range=${SERVICE_CLUSTER_CIDR} \
--service-account-private-key-file=/etc/kubernetes/kube-service-account.key \
--root-ca-file=/etc/kubernetes/kube-ca.pem \
--use-service-account-credentials=true"
kube-scheduler:
image: bestmike007/hyperkube:v1.9.1
container_name: kube-scheduler
restart: always
network_mode: host
volumes:
- /etc/kubernetes:/etc/kubernetes:ro
command: "/usr/local/bin/kube-scheduler \
--leader-elect=true \
--v=2 \
--kubeconfig=/etc/kubernetes/kubecfg-scheduler.yml \
--address=0.0.0.0"
EOF
cat >daemons/kube-node.yml <<EOF
version: '2'
services:
kubelet:
image: bestmike007/hyperkube:v1.9.1
container_name: kubelet
restart: always
privileged: true
pid: host
network_mode: host
volumes:
- /var/log:/var/log
- /dev:/dev
- /run:/run
- /sys:/sys:ro
- /sys/fs/cgroup:/sys/fs/cgroup:rw
- /var/run:/var/run:rw
- /var/lib/docker/:/var/lib/docker:rw
- /var/lib/kubelet/:/var/lib/kubelet:shared
- /etc/kubernetes:/etc/kubernetes:ro
- /etc/cni:/etc/cni:ro
- /opt/cni/bin:/opt/cni/local/bin:rw
command: bash -c "cp /opt/cni/bin/* /opt/cni/local/bin && \
/usr/local/bin/kubelet \
--v=2 \
--address=0.0.0.0 \
--anonymous-auth=false \
--client-ca-file=/etc/kubernetes/kubelet-ca.pem \
--cluster-domain=cluster.local \
--pod-infra-container-image=bestmike007/pause-amd64:3.1 \
--cgroups-per-qos=True \
--enforce-node-allocatable= \
--hostname-override=${CURRENT_NODE} \
--cluster-dns=${CLUSTER_DNS} \
--network-plugin=cni \
--cni-conf-dir=/etc/cni/net.d \
--cni-bin-dir=/opt/cni/local/bin \
--resolv-conf=/etc/resolv.conf \
--allow-privileged=true \
--cloud-provider= \
--kubeconfig=/etc/kubernetes/kubecfg-kubelet.yml \
--require-kubeconfig=True \
--fail-swap-on=false \
--eviction-hard='${EVICTION_HARD}'"
kube-proxy:
image: bestmike007/hyperkube:v1.9.1
container_name: kube-proxy
restart: always
privileged: true
network_mode: host
volumes:
- /etc/kubernetes:/etc/kubernetes:ro
command: "/usr/local/bin/kube-proxy \
--healthz-bind-address=0.0.0.0 \
--kubeconfig=/etc/kubernetes/kubecfg-proxy.yml \
--v=2"
EOF