UNCLASSIFIED - NO CUI

Skip to content
Snippets Groups Projects
Commit a939d458 authored by Micah Nagel's avatar Micah Nagel :moneybag:
Browse files

Merge branch 'reinstall-k3d-feature' into 'master'

[k3d-dev.sh] Rebuild K3D cluster without instance re-creation

Closes #1456

See merge request !2646
parents b597530e 44233c70
No related branches found
No related tags found
1 merge request!2646[k3d-dev.sh] Rebuild K3D cluster without instance re-creation
...@@ -65,7 +65,7 @@ KeyName="${AWSUSERNAME}-dev" ...@@ -65,7 +65,7 @@ KeyName="${AWSUSERNAME}-dev"
SGname="${AWSUSERNAME}-dev" SGname="${AWSUSERNAME}-dev"
# Identify which VPC to create the spot instance in # Identify which VPC to create the spot instance in
VPC="${VPC_ID}" # default VPC VPC="${VPC_ID}" # default VPC
RESET_K3D=false
while [ -n "$1" ]; do # while loop starts while [ -n "$1" ]; do # while loop starts
...@@ -81,7 +81,7 @@ while [ -n "$1" ]; do # while loop starts ...@@ -81,7 +81,7 @@ while [ -n "$1" ]; do # while loop starts
-m) echo "-m option passed to install MetalLB" -m) echo "-m option passed to install MetalLB"
METAL_LB=true METAL_LB=true
;; ;;
-d) echo "-d option passed to destroy the AWS resources" -d) echo "-d option passed to destroy the AWS resources"
AWSINSTANCEIDs=$( aws ec2 describe-instances \ AWSINSTANCEIDs=$( aws ec2 describe-instances \
...@@ -124,89 +124,134 @@ while [ -n "$1" ]; do # while loop starts ...@@ -124,89 +124,134 @@ while [ -n "$1" ]; do # while loop starts
exit 0 exit 0
;; ;;
*) echo "Option $1 not recognized" ;; # In case a non-existant option is submitted *) echo "Option $1 not recognized" ;; # In case a non-existent option is submitted
esac esac
shift shift
done done
echo "Checking for existing cluster for ${AWSUSERNAME}."
if [[ "$BIG_INSTANCE" == true ]] InstId=`aws ec2 describe-instances \
then --output text \
echo "Will use large m5a.4xlarge spot instance" --query "Reservations[].Instances[].InstanceId" \
InstSize="m5a.4xlarge" --filters "Name=tag:Name,Values=${AWSUSERNAME}-dev" "Name=instance-state-name,Values=running"`
SpotPrice="0.69" if [[ ! -z "${InstId}" ]]; then
else PublicIP=`aws ec2 describe-instances --output text --no-cli-pager --instance-id ${InstId} --query "Reservations[].Instances[].PublicIpAddress"`
echo "Will use standard t3a.2xlarge spot instance" echo "Existing cluster found running on instance ${InstId} on ${PublicIP}"
InstSize="t3a.2xlarge" echo "💣 Big Bang Cluster Management 💣"
SpotPrice="0.35" PS3="Please select an option: "
options=("Re-create K3D cluster" "Recreate the EC2 instance from scratch" "Quit")
select opt in "${options[@]}"
do
case $REPLY in
1)
read -p "Are you sure you want to re-create a K3D cluster on this instance (y/n)? " -r
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo
exit 1
fi
RESET_K3D=true
run "k3d cluster delete"
break;;
2)
read -p "Are you sure you want to destroy this instance ${InstId}, and create a new one in its place (y/n)? " -r
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo
exit 1
fi
aws ec2 terminate-instances --instance-ids ${InstId} &>/dev/null
echo -n "Instance is being terminated..."
break;;
3)
echo "Bye."
exit 0;;
*)
echo "Option $1 not recognized";;
esac
done
fi fi
if [[ "${RESET_K3D}" == false ]]; then
if [[ "$BIG_INSTANCE" == true ]]
then
echo "Will use large m5a.4xlarge spot instance"
InstSize="m5a.4xlarge"
SpotPrice="0.69"
else
echo "Will use standard t3a.2xlarge spot instance"
InstSize="t3a.2xlarge"
SpotPrice="0.35"
fi
#### SSH Key Pair
# Create SSH key if it doesn't exist
echo -n Checking if key pair ${KeyName} exists ...
aws ec2 describe-key-pairs --output json --no-cli-pager --key-names ${KeyName} > /dev/null 2>&1 || keypair=missing
if [ "${keypair}" == "missing" ]; then
echo -n -e "missing\nCreating key pair ${KeyName} ... "
aws ec2 create-key-pair --output json --no-cli-pager --key-name ${KeyName} | jq -r '.KeyMaterial' > ~/.ssh/${KeyName}.pem
chmod 600 ~/.ssh/${KeyName}.pem
echo done
else
echo found
fi
#### SSH Key Pair
# Create SSH key if it doesn't exist
echo -n Checking if key pair ${KeyName} exists ...
aws ec2 describe-key-pairs --output json --no-cli-pager --key-names ${KeyName} > /dev/null 2>&1 || keypair=missing
if [ "${keypair}" == "missing" ]; then
echo -n -e "missing\nCreating key pair ${KeyName} ... "
aws ec2 create-key-pair --output json --no-cli-pager --key-name ${KeyName} | jq -r '.KeyMaterial' > ~/.ssh/${KeyName}.pem
chmod 600 ~/.ssh/${KeyName}.pem
echo done
else
echo found
fi
#### Security Group
# Create security group if it doesn't exist
echo -n "Checking if security group ${SGname} exists ..."
aws ec2 describe-security-groups --output json --no-cli-pager --group-names ${SGname} > /dev/null 2>&1 || secgrp=missing
if [ "${secgrp}" == "missing" ]; then
echo -e "missing\nCreating security group ${SGname} ... "
aws ec2 create-security-group --output json --no-cli-pager --description "IP based filtering for ${SGname}" --group-name ${SGname} --vpc-id ${VPC}
echo done
else
echo found
fi
# Lookup the security group created to get the ID #### Security Group
echo -n Retrieving ID for security group ${SGname} ... # Create security group if it doesn't exist
SecurityGroupId=$(aws ec2 describe-security-groups --output json --no-cli-pager --group-names ${SGname} --query "SecurityGroups[0].GroupId" --output text) echo -n "Checking if security group ${SGname} exists ..."
echo done aws ec2 describe-security-groups --output json --no-cli-pager --group-names ${SGname} > /dev/null 2>&1 || secgrp=missing
if [ "${secgrp}" == "missing" ]; then
# Add name tag to security group echo -e "missing\nCreating security group ${SGname} ... "
aws ec2 create-tags --resources ${SecurityGroupId} --tags Key=Name,Value=${SGname} &> /dev/null aws ec2 create-security-group --output json --no-cli-pager --description "IP based filtering for ${SGname}" --group-name ${SGname} --vpc-id ${VPC}
echo done
else
# Add rule for IP based filtering echo found
WorkstationIP=`curl http://checkip.amazonaws.com/ 2> /dev/null` fi
echo -n Checking if ${WorkstationIP} is authorized in security group ...
aws ec2 describe-security-groups --output json --no-cli-pager --group-names ${SGname} | grep ${WorkstationIP} > /dev/null || ipauth=missing # Lookup the security group created to get the ID
if [ "${ipauth}" == "missing" ]; then echo -n Retrieving ID for security group ${SGname} ...
echo -e "missing\nAdding ${WorkstationIP} to security group ${SGname} ..." SecurityGroupId=$(aws ec2 describe-security-groups --output json --no-cli-pager --group-names ${SGname} --query "SecurityGroups[0].GroupId" --output text)
if [[ "$PRIVATE_IP" == true ]];
then
aws ec2 authorize-security-group-ingress --output json --no-cli-pager --group-name ${SGname} --protocol tcp --port 22 --cidr ${WorkstationIP}/32
else # all protocols to all ports is the default
aws ec2 authorize-security-group-ingress --output json --no-cli-pager --group-name ${SGname} --protocol all --cidr ${WorkstationIP}/32
fi
echo done echo done
else
echo found # Add name tag to security group
fi aws ec2 create-tags --resources ${SecurityGroupId} --tags Key=Name,Value=${SGname} &> /dev/null
# Add rule for IP based filtering
WorkstationIP=`curl http://checkip.amazonaws.com/ 2> /dev/null`
echo -n Checking if ${WorkstationIP} is authorized in security group ...
aws ec2 describe-security-groups --output json --no-cli-pager --group-names ${SGname} | grep ${WorkstationIP} > /dev/null || ipauth=missing
if [ "${ipauth}" == "missing" ]; then
echo -e "missing\nAdding ${WorkstationIP} to security group ${SGname} ..."
if [[ "$PRIVATE_IP" == true ]];
then
aws ec2 authorize-security-group-ingress --output json --no-cli-pager --group-name ${SGname} --protocol tcp --port 22 --cidr ${WorkstationIP}/32
else # all protocols to all ports is the default
aws ec2 authorize-security-group-ingress --output json --no-cli-pager --group-name ${SGname} --protocol all --cidr ${WorkstationIP}/32
fi
echo done
else
echo found
fi
##### Launch Specification ##### Launch Specification
# Typical settings for Big Bang development # Typical settings for Big Bang development
InstanceType="${InstSize}" InstanceType="${InstSize}"
VolumeSize=120 VolumeSize=120
echo "Using AMI image id ${AMI_ID}" echo "Using AMI image id ${AMI_ID}"
ImageId="${AMI_ID}" ImageId="${AMI_ID}"
# Create userdata.txt # Create userdata.txt
mkdir -p ~/aws mkdir -p ~/aws
cat << EOF > ~/aws/userdata.txt cat << EOF > ~/aws/userdata.txt
MIME-Version: 1.0 MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="==MYBOUNDARY==" Content-Type: multipart/mixed; boundary="==MYBOUNDARY=="
...@@ -215,39 +260,39 @@ Content-Type: text/x-shellscript; charset="us-ascii" ...@@ -215,39 +260,39 @@ Content-Type: text/x-shellscript; charset="us-ascii"
#!/bin/bash #!/bin/bash
sudo -- bash -c 'sysctl -w vm.max_map_count=524288; \ sudo -- bash -c 'sysctl -w vm.max_map_count=524288; \
echo "vm.max_map_count=524288" > /etc/sysctl.d/vm-max_map_count.conf; \ echo "vm.max_map_count=524288" > /etc/sysctl.d/vm-max_map_count.conf; \
sysctl -w fs.nr_open=13181252; \ sysctl -w fs.nr_open=13181252; \
echo "fs.nr_open=13181252" > /etc/sysctl.d/fs-nr_open.conf; \ echo "fs.nr_open=13181252" > /etc/sysctl.d/fs-nr_open.conf; \
sysctl -w fs.file-max=13181250; \ sysctl -w fs.file-max=13181250; \
echo "fs.file-max=13181250" > /etc/sysctl.d/fs-file-max.conf; \ echo "fs.file-max=13181250" > /etc/sysctl.d/fs-file-max.conf; \
echo "fs.inotify.max_user_instances=1024" > /etc/sysctl.d/fs-inotify-max_user_instances.conf; \ echo "fs.inotify.max_user_instances=1024" > /etc/sysctl.d/fs-inotify-max_user_instances.conf; \
sysctl -w fs.inotify.max_user_instances=1024; \ sysctl -w fs.inotify.max_user_instances=1024; \
echo "fs.inotify.max_user_watches=1048576" > /etc/sysctl.d/fs-inotify-max_user_watches.conf; \ echo "fs.inotify.max_user_watches=1048576" > /etc/sysctl.d/fs-inotify-max_user_watches.conf; \
sysctl -w fs.inotify.max_user_watches=1048576; \ sysctl -w fs.inotify.max_user_watches=1048576; \
echo "fs.may_detach_mounts=1" >> /etc/sysctl.d/fs-may_detach_mounts.conf; \ echo "fs.may_detach_mounts=1" >> /etc/sysctl.d/fs-may_detach_mounts.conf; \
sysctl -w fs.may_detach_mounts=1; \ sysctl -w fs.may_detach_mounts=1; \
sysctl -p; \ sysctl -p; \
echo "* soft nofile 13181250" >> /etc/security/limits.d/ulimits.conf; \ echo "* soft nofile 13181250" >> /etc/security/limits.d/ulimits.conf; \
echo "* hard nofile 13181250" >> /etc/security/limits.d/ulimits.conf; \ echo "* hard nofile 13181250" >> /etc/security/limits.d/ulimits.conf; \
echo "* soft nproc 13181250" >> /etc/security/limits.d/ulimits.conf; \ echo "* soft nproc 13181250" >> /etc/security/limits.d/ulimits.conf; \
echo "* hard nproc 13181250" >> /etc/security/limits.d/ulimits.conf; \ echo "* hard nproc 13181250" >> /etc/security/limits.d/ulimits.conf; \
modprobe br_netfilter; \ modprobe br_netfilter; \
modprobe nf_nat_redirect; \ modprobe nf_nat_redirect; \
modprobe xt_REDIRECT; \ modprobe xt_REDIRECT; \
modprobe xt_owner; \ modprobe xt_owner; \
modprobe xt_statistic; \ modprobe xt_statistic; \
echo "br_netfilter" >> /etc/modules-load.d/istio-iptables.conf; \ echo "br_netfilter" >> /etc/modules-load.d/istio-iptables.conf; \
echo "nf_nat_redirect" >> /etc/modules-load.d/istio-iptables.conf; \ echo "nf_nat_redirect" >> /etc/modules-load.d/istio-iptables.conf; \
echo "xt_REDIRECT" >> /etc/modules-load.d/istio-iptables.conf; \ echo "xt_REDIRECT" >> /etc/modules-load.d/istio-iptables.conf; \
echo "xt_owner" >> /etc/modules-load.d/istio-iptables.conf; \ echo "xt_owner" >> /etc/modules-load.d/istio-iptables.conf; \
echo "xt_statistic" >> /etc/modules-load.d/istio-iptables.conf' echo "xt_statistic" >> /etc/modules-load.d/istio-iptables.conf'
EOF EOF
# Create the device mapping and spot options JSON files # Create the device mapping and spot options JSON files
echo "Creating device_mappings.json ..." echo "Creating device_mappings.json ..."
mkdir -p ~/aws mkdir -p ~/aws
cat << EOF > ~/aws/device_mappings.json cat << EOF > ~/aws/device_mappings.json
[ [
{ {
"DeviceName": "/dev/sda1", "DeviceName": "/dev/sda1",
...@@ -260,8 +305,8 @@ cat << EOF > ~/aws/device_mappings.json ...@@ -260,8 +305,8 @@ cat << EOF > ~/aws/device_mappings.json
] ]
EOF EOF
echo "Creating spot_options.json ..." echo "Creating spot_options.json ..."
cat << EOF > ~/aws/spot_options.json cat << EOF > ~/aws/spot_options.json
{ {
"MarketType": "spot", "MarketType": "spot",
"SpotOptions": { "SpotOptions": {
...@@ -271,112 +316,113 @@ cat << EOF > ~/aws/spot_options.json ...@@ -271,112 +316,113 @@ cat << EOF > ~/aws/spot_options.json
} }
EOF EOF
#### Request a Spot Instance #### Request a Spot Instance
# Location of your private SSH key created during setup # Location of your private SSH key created during setup
PEM=~/.ssh/${KeyName}.pem PEM=~/.ssh/${KeyName}.pem
# Run a spot instance with our launch spec for the max. of 6 hours # Run a spot instance with our launch spec for the max. of 6 hours
# NOTE: t3a.2xlarge spot price is 0.35 m5a.4xlarge is 0.69 # NOTE: t3a.2xlarge spot price is 0.35 m5a.4xlarge is 0.69
echo "Running spot instance ..." echo "Running spot instance ..."
InstId=`aws ec2 run-instances \ InstId=`aws ec2 run-instances \
--output json --no-paginate \ --output json --no-paginate \
--count 1 --image-id "${ImageId}" \ --count 1 --image-id "${ImageId}" \
--instance-type "${InstanceType}" \ --instance-type "${InstanceType}" \
--key-name "${KeyName}" \ --key-name "${KeyName}" \
--security-group-ids "${SecurityGroupId}" \ --security-group-ids "${SecurityGroupId}" \
--instance-initiated-shutdown-behavior "terminate" \ --instance-initiated-shutdown-behavior "terminate" \
--user-data file://$HOME/aws/userdata.txt \ --user-data file://$HOME/aws/userdata.txt \
--block-device-mappings file://$HOME/aws/device_mappings.json \ --block-device-mappings file://$HOME/aws/device_mappings.json \
--instance-market-options file://$HOME/aws/spot_options.json \ --instance-market-options file://$HOME/aws/spot_options.json \
| jq -r '.Instances[0].InstanceId'` | jq -r '.Instances[0].InstanceId'`
# Check if spot instance request was not created # Check if spot instance request was not created
if [ -z ${InstId} ]; then if [ -z ${InstId} ]; then
exit 1; exit 1;
fi fi
# Add name tag to spot instance # Add name tag to spot instance
aws ec2 create-tags --resources ${InstId} --tags Key=Name,Value=${AWSUSERNAME}-dev &> /dev/null aws ec2 create-tags --resources ${InstId} --tags Key=Name,Value=${AWSUSERNAME}-dev &> /dev/null
# Request was created, now you need to wait for it to be filled # Request was created, now you need to wait for it to be filled
echo "Waiting for instance ${InstId} to be ready ..." echo "Waiting for instance ${InstId} to be ready ..."
aws ec2 wait instance-running --output json --no-cli-pager --instance-ids ${InstId} &> /dev/null aws ec2 wait instance-running --output json --no-cli-pager --instance-ids ${InstId} &> /dev/null
# allow some extra seconds for the instance to be fully initiallized # allow some extra seconds for the instance to be fully initiallized
echo "Wait a little longer..." echo "Wait a little longer..."
sleep 15 sleep 15
# Get the public IP address of our instance # Get the public IP address of our instance
PublicIP=`aws ec2 describe-instances --output json --no-cli-pager --instance-ids ${InstId} | jq -r '.Reservations[0].Instances[0].PublicIpAddress'` PublicIP=`aws ec2 describe-instances --output json --no-cli-pager --instance-ids ${InstId} | jq -r '.Reservations[0].Instances[0].PublicIpAddress'`
# Get the private IP address of our instance ##### Configure Instance
PrivateIP=`aws ec2 describe-instances --output json --no-cli-pager --instance-ids ${InstId} | jq -r '.Reservations[0].Instances[0].PrivateIpAddress'` ## TODO: replace these individual commands with userdata when the spot instance is created?
echo
echo
echo "starting instance config"
echo echo "Instance will automatically terminate 8 hours from now unless you alter the root crontab"
echo "Instance ${InstId} is ready!" run "sudo bash -c 'echo \"\$(date -u -d \"+8 hours\" +\"%M %H\") * * * /usr/sbin/shutdown -h now\" | crontab -'"
echo "Instance private IP is ${PrivateIP}" echo
echo "Instance public IP is ${PublicIP}"
echo
# Remove previous keys related to this IP from your SSH known hosts so you don't end up with a conflict echo
ssh-keygen -f "${HOME}/.ssh/known_hosts" -R "${PublicIP}" echo "updating packages"
run "sudo apt-get -y update"
echo "ssh init" echo
# this is a do-nothing remote ssh command just to initialize ssh and make sure that the connection is working echo "installing docker"
until run "hostname"; do # install dependencies
sleep 5 run "sudo apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release gnupg-agent software-properties-common"
echo "Retry ssh command.." # Add the Docker repository, we are installing from Docker and not the Ubuntu APT repo.
done run 'sudo mkdir -m 0755 -p /etc/apt/keyrings'
echo run 'curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg'
run 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null'
run "sudo apt-get update && sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin"
##### Configure Instance echo
## TODO: replace these individual commands with userdata when the spot instance is created? echo
echo # Add your base user to the Docker group so that you do not need sudo to run docker commands
echo run "sudo usermod -aG docker ubuntu"
echo "starting instance config" echo
echo "Instance will automatically terminate 8 hours from now unless you alter the root crontab" # install kubectl
run "sudo bash -c 'echo \"\$(date -u -d \"+8 hours\" +\"%M %H\") * * * /usr/sbin/shutdown -h now\" | crontab -'" echo Installing kubectl...
echo run 'curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"'
run 'sudo mv /home/ubuntu/kubectl /usr/local/bin/'
run 'sudo chmod +x /usr/local/bin/kubectl'
echo # Get the private IP address of our instance
echo "updating packages" PrivateIP=`aws ec2 describe-instances --output json --no-cli-pager --instance-ids ${InstId} | jq -r '.Reservations[0].Instances[0].PrivateIpAddress'`
run "sudo apt-get -y update"
echo echo
echo "installing docker" echo "Instance ${InstId} is ready!"
# install dependencies echo "Instance private IP is ${PrivateIP}"
run "sudo apt-get install -y apt-transport-https ca-certificates curl gnupg lsb-release gnupg-agent software-properties-common" echo "Instance public IP is ${PublicIP}"
# Add the Docker repository, we are installing from Docker and not the Ubuntu APT repo. echo
run 'sudo mkdir -m 0755 -p /etc/apt/keyrings'
run 'curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg'
run 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null'
run "sudo apt-get update && sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin"
echo # Remove previous keys related to this IP from your SSH known hosts so you don't end up with a conflict
echo ssh-keygen -f "${HOME}/.ssh/known_hosts" -R "${PublicIP}"
# Add your base user to the Docker group so that you do not need sudo to run docker commands
run "sudo usermod -aG docker ubuntu"
echo
# install kubectl echo "ssh init"
echo Installing kubectl... # this is a do-nothing remote ssh command just to initialize ssh and make sure that the connection is working
run 'curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"' until run "hostname"; do
run 'sudo mv /home/ubuntu/kubectl /usr/local/bin/' sleep 5
run 'sudo chmod +x /usr/local/bin/kubectl' echo "Retry ssh command.."
done
echo
echo echo
echo echo
# install k3d on instance # install k3d on instance
echo "Installing k3d on instance" echo "Installing k3d on instance"
run "wget -q -O - https://raw.githubusercontent.com/rancher/k3d/main/install.sh | TAG=v5.4.9 bash" run "wget -q -O - https://raw.githubusercontent.com/rancher/k3d/main/install.sh | TAG=v5.4.9 bash"
echo echo
echo "k3d version" echo "k3d version"
run "k3d version" run "k3d version"
echo echo
echo "creating k3d cluster" echo "creating k3d cluster"
fi
# Shared k3d settings across all options # Shared k3d settings across all options
# 1 server, 3 agents # 1 server, 3 agents
...@@ -499,7 +545,7 @@ then ...@@ -499,7 +545,7 @@ then
echo "The IPs to use come from the istio-system services of type LOADBALANCER EXTERNAL-IP that are created when Istio is deployed." echo "The IPs to use come from the istio-system services of type LOADBALANCER EXTERNAL-IP that are created when Istio is deployed."
echo "You must use Firefox browser with with manual SOCKs v5 proxy configuration to localhost with port 12345." echo "You must use Firefox browser with with manual SOCKs v5 proxy configuration to localhost with port 12345."
echo "Also ensure 'Proxy DNS when using SOCKS v5' is checked." echo "Also ensure 'Proxy DNS when using SOCKS v5' is checked."
echo "Or, with other browsers like Chrome you could use a browser plugin like foxyproxy to do the same thing as Firefox." echo "Or, with other browsers like Chrome you could use a browser plugin like foxyproxy to do the same thing as Firefox."
else # using MetalLB and public IP else # using MetalLB and public IP
echo "OPTION 1: ACCESS APPLICATIONS WITH WEB BROWSER ONLY" echo "OPTION 1: ACCESS APPLICATIONS WITH WEB BROWSER ONLY"
echo "To access apps from browser only start ssh with application-level port forwarding:" echo "To access apps from browser only start ssh with application-level port forwarding:"
...@@ -515,7 +561,7 @@ then ...@@ -515,7 +561,7 @@ then
echo "OPTION 2: ACCESS APPLICATIONS WITH WEB BROWSER AND COMMAND LINE" echo "OPTION 2: ACCESS APPLICATIONS WITH WEB BROWSER AND COMMAND LINE"
echo "To access apps from browser and from the workstation command line start sshuttle in a separate terminal window." echo "To access apps from browser and from the workstation command line start sshuttle in a separate terminal window."
echo " sshuttle --dns -vr ubuntu@${PublicIP} 172.20.1.0/24 --ssh-cmd 'ssh -i ~/.ssh/${KeyName}.pem'" echo " sshuttle --dns -vr ubuntu@${PublicIP} 172.20.1.0/24 --ssh-cmd 'ssh -i ~/.ssh/${KeyName}.pem'"
echo "Edit your workstation /etc/hosts to add the LOADBALANCER EXTERNAL-IPs from the istio-sytem servcies with application hostnames." echo "Edit your workstation /etc/hosts to add the LOADBALANCER EXTERNAL-IPs from the istio-system servcies with application hostnames."
echo "Here is an example. You might have to change this depending on the number of gateways you configure for k8s cluster." echo "Here is an example. You might have to change this depending on the number of gateways you configure for k8s cluster."
echo " # METALLB ISTIO INGRESS IPs" echo " # METALLB ISTIO INGRESS IPs"
echo " 172.20.1.240 keycloak.bigbang.dev vault.bigbang.dev" echo " 172.20.1.240 keycloak.bigbang.dev vault.bigbang.dev"
...@@ -528,8 +574,8 @@ then # Not using MetalLB and using private IP ...@@ -528,8 +574,8 @@ then # Not using MetalLB and using private IP
echo echo
echo "To access apps from a browser edit your /etc/hosts to add the private IP of your EC2 instance with application hostnames. Example:" echo "To access apps from a browser edit your /etc/hosts to add the private IP of your EC2 instance with application hostnames. Example:"
echo " ${PrivateIP} gitlab.bigbang.dev prometheus.bigbang.dev kibana.bigbang.dev" echo " ${PrivateIP} gitlab.bigbang.dev prometheus.bigbang.dev kibana.bigbang.dev"
echo echo
else # Not using MetalLB and using pubilc IP. This is the default else # Not using MetalLB and using public IP. This is the default
echo "To access apps from a browser edit your /etc/hosts to add the public IP of your EC2 instance with application hostnames." echo "To access apps from a browser edit your /etc/hosts to add the public IP of your EC2 instance with application hostnames."
echo "Example:" echo "Example:"
echo " ${PublicIP} gitlab.bigbang.dev prometheus.bigbang.dev kibana.bigbang.dev" echo " ${PublicIP} gitlab.bigbang.dev prometheus.bigbang.dev kibana.bigbang.dev"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment