Skip to content

Instantly share code, notes, and snippets.

@gmaliar
Created September 1, 2017 13:09
Show Gist options
  • Select an option

  • Save gmaliar/a73f45b2fc2b029e7791f9a255ee953b to your computer and use it in GitHub Desktop.

Select an option

Save gmaliar/a73f45b2fc2b029e7791f9a255ee953b to your computer and use it in GitHub Desktop.
label kubernetes nodes
#!/bin/sh
INSTANCE_A=$(aws autoscaling describe-auto-scaling-instances | jq '.AutoScalingInstances[] | select(.AutoScalingGroupName == "nodes.production.persistent.us-east-1a.tailor-brands-k8s.com") | .InstanceId')
INSTANCE_B=$(aws autoscaling describe-auto-scaling-instances | jq '.AutoScalingInstances[] | select(.AutoScalingGroupName == "nodes.production.persistent.us-east-1b.tailor-brands-k8s.com") | .InstanceId')
INSTANCE_C=$(aws autoscaling describe-auto-scaling-instances | jq '.AutoScalingInstances[] | select(.AutoScalingGroupName == "nodes.production.persistent.us-east-1c.tailor-brands-k8s.com") | .InstanceId')
NODES=$(aws ec2 describe-instances --filters Name=instance-id,Values=$INSTANCE_A,$INSTANCE_B,$INSTANCE_C | jq --raw-output '.Reservations[].Instances[].NetworkInterfaces[].PrivateDnsName')
kubectl label nodes $NODES persistentNode=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment