Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#cloud-config
apt:
preserve_sources_list: true
sources:
msft.list:
source: "deb https://packages.microsoft.com/ubuntu/18.04/multiarch/prod bionic main"
key: |
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.7 (GNU/Linux)
mQENBFYxWIwBCADAKoZhZlJxGNGWzqV+1OG1xiQeoowKhssGAKvd+buXCGISZJwT
LXZqIcIiLP7pqdcZWtE9bSc7yBY2MalDp9Liu0KekywQ6VVX1T72NPf5Ev6x6DLV
7aVWsCzUAF+eb7DC9fPuFLEdxmOEYoPjzrQ7cCnSV4JQxAqhU4T6OjbvRazGl3ag
OeizPXmRljMtUUttHQZnRhtlzkmwIrUivbfFPD+fEoHJ1+uIdfOzZX8/oKHKLe2j
H632kvsNzJFlROVvGLYAk2WRcLu+RjjggixhwiB+Mu/A8Tf4V6b+YppS44q8EvVr
M+QvY7LNSOffSO6Slsy9oisGTdfE39nC7pVRABEBAAG0N01pY3Jvc29mdCAoUmVs
ZWFzZSBzaWduaW5nKSA8Z3Bnc2VjdXJpdHlAbWljcm9zb2Z0LmNvbT6JATUEEwEC
AB8FAlYxWIwCGwMGCwkIBwMCBBUCCAMDFgIBAh4BAheAAAoJEOs+lK2+EinPGpsH
/32vKy29Hg51H9dfFJMx0/a/F+5vKeCeVqimvyTM04C+XENNuSbYZ3eRPHGHFLqe
MNGxsfb7C7ZxEeW7J/vSzRgHxm7ZvESisUYRFq2sgkJ+HFERNrqfci45bdhmrUsy
7SWw9ybxdFOkuQoyKD3tBmiGfONQMlBaOMWdAsic965rvJsd5zYaZZFI1UwTkFXV
KJt3bp3Ngn1vEYXwijGTa+FXz6GLHueJwF0I7ug34DgUkAFvAs8Hacr2DRYxL5RJ
XdNgj4Jd2/g6T9InmWT0hASljur+dJnzNiNCkbn9KbX7J/qK1IbR8y560yRmFsU+
NdCFTW7wY0Fb1fWJ+/KTsC4=
=J6gs
-----END PGP PUBLIC KEY BLOCK-----
packages:
- moby-cli
- moby-engine
- jq
- unzip
- tree
runcmd:
- |
set -x
(
# Kubectl
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.17.0/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
alias k=''kubectl''
# Install K9s (visual cluster explorer)
wget https://github.com/derailed/k9s/releases/download/v0.15.2/k9s_Linux_x86_64.tar.gz
tar xvf ./k9s_Linux_x86_64.tar.gz
mv ./k9s /usr/local/bin/
rm ./k9s_Linux_x86_64.tar.gz ./LICENSE ./README.md
# Install Helm 3
wget https://get.helm.sh/helm-v3.1.0-linux-amd64.tar.gz
tar xvf ./helm-v3.1.0-linux-amd64.tar.gz
mv ./linux-amd64/helm /usr/local/bin
rm -rf ./linux-amd64/
# Wait for docker daemon to start
while [ $(ps -ef | grep -v grep | grep docker | wc -l) -le 0 ]; do
sleep 3
done
# Download and bootstrap k3d cluster
wget -q -O - https://raw.githubusercontent.com/rancher/k3d/master/install.sh | TAG=v1.6.0 bash
k3d create -n k3s1 -w 1 --image rancher/k3s:v1.17.2-k3s1 --server-arg "--no-deploy=traefik"
sleep 20
# Set default KUBECONFIG
mkdir /home/', variables('user'), '/.kube
cat $(sudo k3d get-kubeconfig --name=''k3s1'') > /home/', variables('user'), '/.kube/config
sleep 5
# Install IoT Edge
kubectl create ns helloworld --kubeconfig=/home/', variables('user'), '/.kube/config
helm install --repo https://edgek8s.blob.core.windows.net/staging edge-crd edge-kubernetes-crd --kubeconfig=/home/', variables('user'), '/.kube/config
helm install --repo https://edgek8s.blob.core.windows.net/staging edge1 edge-kubernetes --namespace helloworld --set "provisioning.deviceConnectionString=', variables('dcs'), '" --kubeconfig=/home/', variables('user'), '/.kube/config
echo done
) &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment