add support for AWS
parent
5d794d8280
commit
ed7b9fc2da
|
@ -18,6 +18,12 @@ VPC_ID=$(aws ec2 create-vpc \
|
|||
jq -r '.Vpc.VpcId')
|
||||
```
|
||||
|
||||
```
|
||||
aws ec2 create-tags \
|
||||
--resources ${VPC_ID} \
|
||||
--tags Key=Name,Value=kubernetes
|
||||
```
|
||||
|
||||
```
|
||||
aws ec2 modify-vpc-attribute \
|
||||
--vpc-id ${VPC_ID} \
|
||||
|
@ -37,6 +43,12 @@ DHCP_OPTION_SET_ID=$(aws ec2 create-dhcp-options \
|
|||
jq -r '.DhcpOptions.DhcpOptionsId')
|
||||
```
|
||||
|
||||
```
|
||||
aws ec2 create-tags \
|
||||
--resources ${DHCP_OPTION_SET_ID} \
|
||||
--tags Key=Name,Value=kubernetes
|
||||
```
|
||||
|
||||
```
|
||||
aws ec2 associate-dhcp-options \
|
||||
--dhcp-options-id ${DHCP_OPTION_SET_ID} \
|
||||
|
@ -52,6 +64,12 @@ SUBNET_ID=$(aws ec2 create-subnet \
|
|||
jq -r '.Subnet.SubnetId')
|
||||
```
|
||||
|
||||
```
|
||||
aws ec2 create-tags \
|
||||
--resources ${SUBNET_ID} \
|
||||
--tags Key=Name,Value=kubernetes
|
||||
```
|
||||
|
||||
Create an internet gateway
|
||||
|
||||
```
|
||||
|
@ -59,6 +77,12 @@ INTERNET_GATEWAY_ID=$(aws ec2 create-internet-gateway | \
|
|||
jq -r '.InternetGateway.InternetGatewayId')
|
||||
```
|
||||
|
||||
```
|
||||
aws ec2 create-tags \
|
||||
--resources ${INTERNET_GATEWAY_ID} \
|
||||
--tags Key=Name,Value=kubernetes
|
||||
```
|
||||
|
||||
```
|
||||
aws ec2 attach-internet-gateway \
|
||||
--internet-gateway-id ${INTERNET_GATEWAY_ID} \
|
||||
|
@ -73,6 +97,12 @@ ROUTE_TABLE_ID=$(aws ec2 create-route-table \
|
|||
jq -r '.RouteTable.RouteTableId')
|
||||
```
|
||||
|
||||
```
|
||||
aws ec2 create-tags \
|
||||
--resources ${ROUTE_TABLE_ID} \
|
||||
--tags Key=Name,Value=kubernetes
|
||||
```
|
||||
|
||||
```
|
||||
aws ec2 associate-route-table \
|
||||
--route-table-id ${ROUTE_TABLE_ID} \
|
||||
|
@ -96,6 +126,12 @@ SECURITY_GROUP_ID=$(aws ec2 create-security-group \
|
|||
jq -r '.GroupId')
|
||||
```
|
||||
|
||||
```
|
||||
aws ec2 create-tags \
|
||||
--resources ${SECURITY_GROUP_ID} \
|
||||
--tags Key=Name,Value=kubernetes
|
||||
```
|
||||
|
||||
```
|
||||
aws ec2 authorize-security-group-ingress \
|
||||
--group-id ${SECURITY_GROUP_ID} \
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
# Cleaning Up
|
||||
|
||||
## Virtual Machines
|
||||
## GCP
|
||||
|
||||
### Virtual Machines
|
||||
|
||||
```
|
||||
gcloud compute instances delete \
|
||||
|
@ -9,8 +11,7 @@ gcloud compute instances delete \
|
|||
etcd0 etcd1 etcd2
|
||||
```
|
||||
|
||||
## Networking
|
||||
|
||||
### Networking
|
||||
|
||||
```
|
||||
gcloud compute forwarding-rules delete kubernetes-rule
|
||||
|
@ -53,4 +54,147 @@ gcloud compute networks subnets delete kubernetes
|
|||
|
||||
```
|
||||
gcloud compute networks delete kubernetes
|
||||
```
|
||||
```
|
||||
|
||||
|
||||
## AWS
|
||||
|
||||
### VMs
|
||||
|
||||
```
|
||||
KUBERNETES_HOSTS=(controller0 controller1 controller2 etcd0 etcd1 etcd2 worker0 worker1 worker2)
|
||||
```
|
||||
|
||||
```
|
||||
for host in ${KUBERNETES_HOSTS[*]}; do
|
||||
INSTANCE_ID=$(aws ec2 describe-instances \
|
||||
--filters "Name=tag:Name,Values=${host}" | \
|
||||
jq -j '.Reservations[].Instances[].InstanceId')
|
||||
aws ec2 terminate-instances --instance-ids ${INSTANCE_ID}
|
||||
done
|
||||
```
|
||||
|
||||
### IAM
|
||||
|
||||
```
|
||||
aws iam remove-role-from-instance-profile \
|
||||
--instance-profile-name kubernetes \
|
||||
--role-name kubernetes
|
||||
```
|
||||
|
||||
```
|
||||
aws iam delete-instance-profile \
|
||||
--instance-profile-name kubernetes
|
||||
```
|
||||
|
||||
```
|
||||
aws iam delete-role-policy \
|
||||
--role-name kubernetes \
|
||||
--policy-name kubernetes
|
||||
```
|
||||
|
||||
```
|
||||
aws iam delete-role --role-name kubernetes
|
||||
```
|
||||
|
||||
### SSH Keys
|
||||
|
||||
```
|
||||
aws ec2 delete-key-pair --key-name kubernetes
|
||||
```
|
||||
|
||||
### Networking
|
||||
|
||||
#### Load Balancers
|
||||
|
||||
```
|
||||
aws elb delete-load-balancer \
|
||||
--load-balancer-name kubernetes
|
||||
```
|
||||
|
||||
#### Security Groups
|
||||
|
||||
```
|
||||
SECURITY_GROUP_ID=$(aws ec2 describe-security-groups \
|
||||
--filters "Name=tag:Name,Values=kubernetes" | \
|
||||
jq -r '.SecurityGroups[].GroupId')
|
||||
```
|
||||
|
||||
```
|
||||
aws ec2 delete-security-group \
|
||||
--group-id ${SECURITY_GROUP_ID}
|
||||
```
|
||||
|
||||
#### Internet Gateways
|
||||
|
||||
```
|
||||
VPC_ID=$(aws ec2 describe-vpcs \
|
||||
--filters "Name=tag:Name,Values=kubernetes" | \
|
||||
jq -r '.Vpcs[].VpcId')
|
||||
```
|
||||
|
||||
```
|
||||
INTERNET_GATEWAY_ID=$(aws ec2 describe-internet-gateways \
|
||||
--filters "Name=tag:Name,Values=kubernetes" | \
|
||||
jq -r '.InternetGateways[].InternetGatewayId')
|
||||
```
|
||||
|
||||
```
|
||||
aws ec2 detach-internet-gateway \
|
||||
--internet-gateway-id ${INTERNET_GATEWAY_ID} \
|
||||
--vpc-id ${VPC_ID}
|
||||
```
|
||||
|
||||
```
|
||||
aws ec2 delete-internet-gateway \
|
||||
--internet-gateway-id ${INTERNET_GATEWAY_ID}
|
||||
```
|
||||
|
||||
#### Route Tables
|
||||
|
||||
```
|
||||
ROUTE_TABLE_ID=$(aws ec2 describe-route-tables \
|
||||
--filters "Name=tag:Name,Values=kubernetes" | \
|
||||
jq -r '.RouteTables[].RouteTableId')
|
||||
```
|
||||
|
||||
```
|
||||
aws ec2 delete-route-table --route-table-id ${ROUTE_TABLE_ID}
|
||||
```
|
||||
|
||||
#### Subnets
|
||||
|
||||
```
|
||||
SUBNET_ID=$(aws ec2 describe-subnets \
|
||||
--filters "Name=tag:Name,Values=kubernetes" | \
|
||||
jq -r '.Subnets[].SubnetId')
|
||||
```
|
||||
|
||||
```
|
||||
aws ec2 delete-subnet --subnet-id ${SUBNET_ID}
|
||||
```
|
||||
|
||||
#### VPC
|
||||
|
||||
```
|
||||
VPC_ID=$(aws ec2 describe-vpcs \
|
||||
--filters "Name=tag:Name,Values=kubernetes" | \
|
||||
jq -r '.Vpcs[].VpcId')
|
||||
```
|
||||
|
||||
```
|
||||
aws ec2 delete-vpc --vpc-id ${VPC_ID}
|
||||
```
|
||||
|
||||
#### DHCP Option Sets
|
||||
|
||||
```
|
||||
DHCP_OPTION_SET_ID=$(aws ec2 describe-dhcp-options \
|
||||
--filters "Name=tag:Name,Values=kubernetes" | \
|
||||
jq -r '.DhcpOptions[].DhcpOptionsId')
|
||||
```
|
||||
|
||||
```
|
||||
aws ec2 delete-dhcp-options \
|
||||
--dhcp-options-id ${DHCP_OPTION_SET_ID}
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue