Skip to content

Instantly share code, notes, and snippets.

View gree-gorey's full-sized avatar
:octocat:
Focusing

Grigorii Ignatev gree-gorey

:octocat:
Focusing
  • National Research University Higher School of Economics
  • Munich, Germany
View GitHub Profile
#!/bin/bash
set -o xtrace
rm -rf /etc/cni/net.d/*
ID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)
REGION=$(curl -s http://169.254.169.254/latest/dynamic/instance-identity/document | jq -r '.region')
LIFECYCLE=$(aws ec2 describe-instances --region=$REGION --instance-ids=$ID | jq -r '.Reservations[].Instances[].InstanceLifecycle')
if [[ $LIFECYCLE = "spot" ]]; then
EXTRA_ARGS="--node-labels=lifecycle=Ec2Spot,aws.amazon.com/spot=true,node-role.kubernetes.io/spot-worker=";
else

Emoji in CR

$ kubectl create -f crd.yaml
customresourcedefinition.apiextensions.k8s.io/emojis.emoji.local created
$  kubectl create -f cr.yaml 
emoji.emoji.local/example-emoji created
$ kubectl get emoji example-emoji -o json
{
 "apiVersion": "emoji.local/v1alpha1",

Usage:

$ kubectl get nodes -o go-template-file=./taints-labels.tmpl

Output:

my-master-node
	Taints:
 node-role.kubernetes.io/master=:NoSchedule