33 строки
1.3 KiB
Bash
33 строки
1.3 KiB
Bash
|
#!/usr/bin/env bash
|
||
|
#-------------------------------------------------------------------------------------------------------------
|
||
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||
|
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
|
||
|
#-------------------------------------------------------------------------------------------------------------
|
||
|
|
||
|
# Syntax: ./kubectl-helm-debian.sh
|
||
|
|
||
|
set -e
|
||
|
|
||
|
if [ "$(id -u)" -ne 0 ]; then
|
||
|
echo -e 'Script must be run a root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
export DEBIAN_FRONTEND=noninteractive
|
||
|
|
||
|
# Install curl if missing
|
||
|
if ! dpkg -s curl ca-certificates > /dev/null 2>&1; then
|
||
|
if [ ! -d "/var/lib/apt/lists" ] || [ "$(ls /var/lib/apt/lists/ | wc -l)" = "0" ]; then
|
||
|
apt-get update
|
||
|
fi
|
||
|
apt-get -y install --no-install-recommends curl ca-certificates
|
||
|
fi
|
||
|
|
||
|
# Install the kubectl
|
||
|
echo "Downloading kubectl..."
|
||
|
curl -sSL -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
|
||
|
chmod +x /usr/local/bin/kubectl
|
||
|
# Install Helm
|
||
|
echo "Installing Helm..."
|
||
|
curl -s https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash -
|
||
|
echo "Done!"
|