-
Notifications
You must be signed in to change notification settings - Fork 983
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate the command line commands in the getting started guide last …
…part (#1429) Seperates all the remaining command line instructions into .sh files for the getting started with EKS doc.
- Loading branch information
1 parent
761554c
commit 6fd9437
Showing
16 changed files
with
136 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
.../content/en/preview/getting-started/getting-started-with-eksctl/scripts/add-monitoring.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
set -euo pipefail #fail if one step fails | ||
|
||
if [ "$#" -ne 1 ] | ||
then | ||
echo "Missing required Karpenter version. Usage: add-monitoring.sh v0.0.1" | ||
exit 1 | ||
fi | ||
|
||
export KARPENTER_VERSION=$1 | ||
|
||
declare -a steps=( | ||
step01-config.sh | ||
step09-add-prometheus-grafana.sh | ||
step10-add-grafana-port-forward.sh | ||
step11-grafana-get-password.sh | ||
) | ||
|
||
for step in "${steps[@]}"; do | ||
echo "$step" | ||
source $step | ||
done |
14 changes: 14 additions & 0 deletions
14
...content/en/preview/getting-started/getting-started-with-eksctl/scripts/add-provisioner.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
set -euo pipefail #fail if one step fails | ||
|
||
declare -a steps=( | ||
step01-config.sh | ||
step12-add-provisioner.sh | ||
step13-automatic-node-provisioning.sh | ||
step14-automatic-node-termination.sh | ||
) | ||
|
||
for step in "${steps[@]}"; do | ||
echo "$step" | ||
source $step | ||
done |
12 changes: 12 additions & 0 deletions
12
website/content/en/preview/getting-started/getting-started-with-eksctl/scripts/cleanup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
declare -a steps=( | ||
step01-config.sh | ||
step14-deprovisioning.sh | ||
step16-cleanup.sh | ||
) | ||
|
||
for step in "${steps[@]}"; do | ||
echo "$step" | ||
source $step | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...nt/en/preview/getting-started/getting-started-with-eksctl/scripts/step06-add-spot-role.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
aws iam create-service-linked-role --aws-service-name spot.amazonaws.com | ||
# If the role has already been successfully created, you will see: | ||
# An error occurred (InvalidInput) when calling the CreateServiceLinkedRole operation: Service role name AWSServiceRoleForEC2Spot has been taken in this account, please try a different suffix. |
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions
11
...view/getting-started/getting-started-with-eksctl/scripts/step09-add-prometheus-grafana.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
helm repo add grafana-charts https://grafana.github.io/helm-charts | ||
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts | ||
helm repo update | ||
|
||
kubectl create namespace monitoring | ||
|
||
curl -fsSL https://karpenter.sh/"${KARPENTER_VERSION}"/getting-started/getting-started-with-eksctl/prometheus-values.yaml | tee prometheus-values.yaml | ||
helm install --namespace monitoring prometheus prometheus-community/prometheus --values prometheus-values.yaml | ||
|
||
curl -fsSL https://karpenter.sh/"${KARPENTER_VERSION}"/getting-started/getting-started-with-eksctl/grafana-values.yaml | tee grafana-values.yaml | ||
helm install --namespace monitoring grafana grafana-charts/grafana --values grafana-values.yaml |
1 change: 1 addition & 0 deletions
1
...ew/getting-started/getting-started-with-eksctl/scripts/step10-add-grafana-port-forward.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
kubectl port-forward --namespace monitoring svc/grafana 3000:80 |
1 change: 1 addition & 0 deletions
1
...review/getting-started/getting-started-with-eksctl/scripts/step11-grafana-get-password.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
kubectl get secret --namespace monitoring grafana -o jsonpath="{.data.admin-password}" | base64 --decode |
20 changes: 20 additions & 0 deletions
20
.../en/preview/getting-started/getting-started-with-eksctl/scripts/step12-add-provisioner.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
cat <<EOF | kubectl apply -f - | ||
apiVersion: karpenter.sh/v1alpha5 | ||
kind: Provisioner | ||
metadata: | ||
name: default | ||
spec: | ||
requirements: | ||
- key: karpenter.sh/capacity-type | ||
operator: In | ||
values: ["spot"] | ||
limits: | ||
resources: | ||
cpu: 1000 | ||
provider: | ||
subnetSelector: | ||
karpenter.sh/discovery: ${CLUSTER_NAME} | ||
securityGroupSelector: | ||
karpenter.sh/discovery: ${CLUSTER_NAME} | ||
ttlSecondsAfterEmpty: 30 | ||
EOF |
25 changes: 25 additions & 0 deletions
25
...getting-started/getting-started-with-eksctl/scripts/step13-automatic-node-provisioning.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
cat <<EOF | kubectl apply -f - | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: inflate | ||
spec: | ||
replicas: 0 | ||
selector: | ||
matchLabels: | ||
app: inflate | ||
template: | ||
metadata: | ||
labels: | ||
app: inflate | ||
spec: | ||
terminationGracePeriodSeconds: 0 | ||
containers: | ||
- name: inflate | ||
image: public.ecr.aws/eks-distro/kubernetes/pause:3.2 | ||
resources: | ||
requests: | ||
cpu: 1 | ||
EOF | ||
kubectl scale deployment inflate --replicas 5 | ||
kubectl logs -f -n karpenter -l app.kubernetes.io/name=karpenter -c controller |
2 changes: 2 additions & 0 deletions
2
...t/en/preview/getting-started/getting-started-with-eksctl/scripts/step14-deprovisioning.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
kubectl delete deployment inflate | ||
kubectl logs -f -n karpenter -l app.kubernetes.io/name=karpenter -c controller |
1 change: 1 addition & 0 deletions
1
...tent/en/preview/getting-started/getting-started-with-eksctl/scripts/step15-delete-node.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
kubectl delete node $NODE_NAME |
8 changes: 8 additions & 0 deletions
8
.../content/en/preview/getting-started/getting-started-with-eksctl/scripts/step16-cleanup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
helm uninstall karpenter --namespace karpenter | ||
aws iam delete-role --role-name "${CLUSTER_NAME}-karpenter" | ||
aws cloudformation delete-stack --stack-name "Karpenter-${CLUSTER_NAME}" | ||
aws ec2 describe-launch-templates \ | ||
| jq -r ".LaunchTemplates[].LaunchTemplateName" \ | ||
| grep -i "Karpenter-${CLUSTER_NAME}" \ | ||
| xargs -I{} aws ec2 delete-launch-template --launch-template-name {} | ||
eksctl delete cluster --name "${CLUSTER_NAME}" |