forked from Azure/acs-engine
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Private Commit for Azure Console Shell
Remove SPN secrets from agent node Remove the Kube Dashboard and Heapster Addons Add agentpool label on the agent nodes Use static IP address for system and agentpool1
- Loading branch information
1 parent
cb47749
commit 87c56c3
Showing
15 changed files
with
225 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
#!/bin/bash | ||
|
||
########################################################### | ||
# START SECRET DATA - ECHO DISABLED | ||
########################################################### | ||
|
||
# Fields for `azure.json` | ||
KUBELET_PRIVATE_KEY="${1}" | ||
NETWORK_POLICY="${2}" | ||
|
||
KUBELET_PRIVATE_KEY_PATH="/etc/kubernetes/certs/client.key" | ||
touch "${KUBELET_PRIVATE_KEY_PATH}" | ||
chmod 0644 "${KUBELET_PRIVATE_KEY_PATH}" | ||
chown root:root "${KUBELET_PRIVATE_KEY_PATH}" | ||
echo "${KUBELET_PRIVATE_KEY}" | base64 --decode > "${KUBELET_PRIVATE_KEY_PATH}" | ||
|
||
########################################################### | ||
# END OF SECRET DATA | ||
########################################################### | ||
|
||
set -x | ||
|
||
function ensureDocker() { | ||
systemctl enable docker | ||
systemctl restart docker | ||
dockerStarted=1 | ||
for i in {1..600}; do | ||
if ! /usr/bin/docker info; then | ||
echo "status $?" | ||
/bin/systemctl restart docker | ||
else | ||
echo "docker started" | ||
dockerStarted=0 | ||
break | ||
fi | ||
sleep 1 | ||
done | ||
if [ $dockerStarted -ne 0 ] | ||
then | ||
echo "docker did not start" | ||
exit 1 | ||
fi | ||
} | ||
|
||
function setAgentPool() { | ||
AGENTPOOL=`hostname | cut -d- -f2` | ||
sed -i "s/^KUBELET_NODE_LABELS=.*/KUBELET_NODE_LABELS=role=agent,agentpool=${AGENTPOOL}/" /etc/default/kubelet | ||
} | ||
|
||
function ensureKubelet() { | ||
systemctl enable kubelet | ||
systemctl restart kubelet | ||
} | ||
|
||
function setNetworkPlugin () { | ||
sed -i "s/^KUBELET_NETWORK_PLUGIN=.*/KUBELET_NETWORK_PLUGIN=${1}/" /etc/default/kubelet | ||
} | ||
|
||
function setDockerOpts () { | ||
sed -i "s#^DOCKER_OPTS=.*#DOCKER_OPTS=${1}#" /etc/default/kubelet | ||
} | ||
|
||
function configNetworkPolicy() { | ||
if [[ ! -z "${APISERVER_PRIVATE_KEY}" ]]; then | ||
# on masters | ||
ADDONS="calico-configmap.yaml calico-daemonset.yaml" | ||
ADDONS_PATH=/etc/kubernetes/addons | ||
CALICO_URL="https://github.com/simonswine/calico/raw/master/v2.0/getting-started/kubernetes/installation/hosted/k8s-backend-addon-manager" | ||
if [[ "${NETWORK_POLICY}" = "calico" ]]; then | ||
# download calico yamls | ||
for addon in ${ADDONS}; do | ||
curl -o "${ADDONS_PATH}/${addon}" -sSL --retry 12 --retry-delay 10 "${CALICO_URL}/${addon}" | ||
done | ||
else | ||
# make sure calico yaml are removed | ||
for addon in ${ADDONS}; do | ||
rm -f "${ADDONS_PATH}/${addon}" | ||
done | ||
fi | ||
else | ||
# on agents | ||
if [[ "${NETWORK_POLICY}" = "calico" ]]; then | ||
setNetworkPlugin cni | ||
setDockerOpts " --volume=/etc/cni/:/etc/cni:ro --volume=/opt/cni/:/opt/cni:ro" | ||
else | ||
setNetworkPlugin kubenet | ||
setDockerOpts "" | ||
fi | ||
fi | ||
} | ||
|
||
ensureDocker | ||
configNetworkPolicy | ||
setAgentPool | ||
ensureKubelet | ||
|
||
echo "Install complete successfully" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
[Unit] | ||
Description=Kubelet | ||
Requires=docker.service | ||
After=docker.service | ||
|
||
[Service] | ||
Restart=always | ||
EnvironmentFile=/etc/default/kubelet | ||
SuccessExitStatus=143 | ||
ExecStartPre=/bin/bash /opt/azure/containers/kubelet.sh | ||
ExecStartPre=/bin/mkdir -p /var/lib/kubelet | ||
ExecStartPre=/bin/bash -c "if [ $(mount | grep \"/var/lib/kubelet\" | wc -l) -le 0 ] ; then /bin/mount --bind /var/lib/kubelet /var/lib/kubelet ; fi" | ||
ExecStartPre=/bin/mount --make-shared /var/lib/kubelet | ||
ExecStartPre=-/sbin/ebtables -t nat --list | ||
ExecStartPre=-/sbin/iptables -t nat --list | ||
ExecStart=/usr/bin/docker run \ | ||
--net=host \ | ||
--pid=host \ | ||
--privileged \ | ||
--rm \ | ||
--volume=/dev:/dev \ | ||
--volume=/sys:/sys:ro \ | ||
--volume=/var/run:/var/run:rw \ | ||
--volume=/var/lib/docker/:/var/lib/docker:rw \ | ||
--volume=/var/lib/kubelet/:/var/lib/kubelet:shared \ | ||
--volume=/var/log:/var/log:rw \ | ||
--volume=/etc/kubernetes/:/etc/kubernetes:ro \ | ||
--volume=/srv/kubernetes/:/srv/kubernetes:ro $DOCKER_OPTS \ | ||
${KUBELET_IMAGE} \ | ||
/hyperkube kubelet \ | ||
--kubeconfig=/var/lib/kubelet/kubeconfig \ | ||
--require-kubeconfig \ | ||
--pod-infra-container-image="${KUBELET_POD_INFRA_CONTAINER_IMAGE}" \ | ||
--address=0.0.0.0 \ | ||
--allow-privileged=true \ | ||
--enable-server \ | ||
--enable-debugging-handlers \ | ||
--pod-manifest-path=/etc/kubernetes/manifests \ | ||
--cluster-dns=${KUBELET_CLUSTER_DNS} \ | ||
--cluster-domain=cluster.local \ | ||
--register-schedulable=${KUBELET_REGISTER_SCHEDULABLE} \ | ||
--node-labels=${KUBELET_NODE_LABELS} \ | ||
--cloud-provider= \ | ||
--cloud-config= \ | ||
--azure-container-registry-config= \ | ||
--hairpin-mode=promiscuous-bridge \ | ||
--network-plugin=${KUBELET_NETWORK_PLUGIN} \ | ||
--v=2 | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
parts/kubernetesmasteraddons-kubernetes-dashboard-service.yaml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1110,4 +1110,4 @@ func GetClassicSizeMap() string { | |
} | ||
} | ||
` | ||
} | ||
} |
Oops, something went wrong.