Skip to content

Instantly share code, notes, and snippets.

@slaysd
Last active February 12, 2020 12:44
Show Gist options
  • Save slaysd/35ea823c1988163955c4814d50d5ff2d to your computer and use it in GitHub Desktop.
Save slaysd/35ea823c1988163955c4814d50d5ff2d to your computer and use it in GitHub Desktop.
AWS EKS + Jenkins X 환경설치 스크립트
#!/bin/bash
CLUSTER_NAME={{TYPE YOUR CLUSTER NAME}}
REGION={{ TYPE YOUR AWS EKS REGION NAME }}
echo "AWS CLI 설치"
pip install awscli --upgrade --user
export PATH=$HOME/.local/bin:$PATH
echo 'export PATH=$HOME/.local/bin:$PATH' >> $HOME/.zshrc
echo "kubectl 설치"
# Linux
if [[ "$OSTYPE" == "linux-gnu" ]]; then
curl -o kubectl https://amazon-eks.s3-us-west-2.amazonaws.com/1.14.6/2019-08-22/bin/linux/amd64/kubectl
# MacOS
elif [[ "$OSTYPE" == "darwin"* ]]; then
curl -o kubectl https://amazon-eks.s3-us-west-2.amazonaws.com/1.14.6/2019-08-22/bin/darwin/amd64/kubectl
chmod +x ./kubectl
mkdir -p $HOME/.bin && cp ./kubectl $HOME/.bin/kubectl && export PATH=$HOME/.bin:$PATH
if [ -n "$ZSH_VERSION" ]; then
# assume Zsh
echo 'export PATH=$HOME/.bin:$PATH' >> $HOME/.zshrc
echo 'alias k=kubectl' >> $HOME/.zshrc
elif [ -n "$BASH_VERSION" ]; then
# assume Bash
echo 'export PATH=$HOME/.bin:$PATH' >> $HOME/.bashrc
echo 'alias k=kubectl' >> $HOME/.bashrc
fi
echo "AWS Configure 시작 (region: $REGION, output: json)"
aws configure
aws eks --region $REGION update-kubeconfig --name $CLUSTER_NAME
echo "JX 설치"
# Linux
if [[ "$OSTYPE" == "linux-gnu" ]]; then
curl -L "https://github.com/jenkins-x/jx/releases/download/$(curl --silent "https://github.com/jenkins-x/jx/releases/latest" | sed 's#.*tag/\(.*\)\".*#\1#')/jx-linux-amd64.tar.gz" | tar xzv "jx"
chmod +x ./jx
mv jx $HOME/.bin
# MacOS
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install jenkins-x/jx/jx
jx version
echo "Helm 설치"
curl -L https://git.io/get_helm.sh | bash
helm init --client-only
helm repo add jenkins-x http://chartmuseum.jenkins-x.io
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment