-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/etc/eks/bootstrap.sh devops3-vlocity-kube --kubelet-extra-args "--node-labels=jenkins=true --register-with-taints=dedicated=jenkins:NoSchedule" #179
Comments
I used the below command with the double quotes and again tried with the single quotes as well. |
Hello mate, it's because you are not escaping stuff properly. Such user-data works for me without problem
|
As @gacopl noted, you need to properly escape quotes. Does that fix the issue for you? |
Does anyone happen to know how those escapes change if the script is being called via terraform? Here's how we set up the call to the script in terraform: Editing this to what works for us:
|
This is what I'm using:
|
As most of you mentioned, the problems are the quotes, I'm using cfn template to deploy my nodes and after spent some time checking it, I created a custom userData script: UserData:
Fn::Base64: !Sub | #!/bin/bash
set -e
set -o xtrace
CMD_EXTRA_ARG=""
FIXED_NODES_LABELS="aws.eks.cluster=${ClusterName},aws.eks.nodegroup=${NodeGroupName}"
FIXED_NODES_TAINTS=""
# Add more arguments from parameter
if [ ! -z "${AditionalExtraArguments}" ]
then
CMD_EXTRA_ARG=$CMD_EXTRA_ARG"${AditionalExtraArguments}"
fi
# Add more labels from parameter
if [ ! -z "${CustomNodeLabels}" ]
then
if [ ! -z "$FIXED_NODES_LABELS" ]
then
NODES_LABELS=$FIXED_NODES_LABELS,${CustomNodeLabels}
else
NODES_LABELS=${CustomNodeLabels}
fi
CMD_EXTRA_ARG=$CMD_EXTRA_ARG" --node-labels="$NODES_LABELS
fi
# Add more taints from parameter
if [ ! -z "${CustomNodeTaints}" ]
then
if [ ! -z "$FIXED_NODES_TAINTS" ]
then
NODES_TAINTS=$FIXED_NODES_TAINTS,${CustomNodeTaints}
else
NODES_TAINTS="\"${CustomNodeTaints}\""
fi
CMD_EXTRA_ARG="$CMD_EXTRA_ARG --register-with-taints=$NODES_TAINTS"
fi
if [ ! -z "$CMD_EXTRA_ARG" ]
then
/etc/eks/bootstrap.sh ${ClusterName} ${BootstrapArguments} --kubelet-extra-args "$CMD_EXTRA_ARG"
else
/etc/eks/bootstrap.sh ${ClusterName} ${BootstrapArguments}
fi
/opt/aws/bin/cfn-signal --exit-code $? \
--stack ${AWS::StackName} \
--resource NodeGroup \
--region ${AWS::Region}
My cfn parameters template are CustomNodeLabels:
Type: String
Default: ""
Description: |
String in format key1=value1,key2=value2,... see: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
Example: custom.workload.type=monitoring,custom.company=SomeCompany
CustomNodeTaints:
Type: String
Default: ""
Description: |
String in format key1=value1:NoSchedule,key2=value2:NoExecute,... see: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
Example: dedicated=monitoring:NoSchedule
BootstrapArguments:
Type: String
Default: ""
Description: |
Arguments to pass to the bootstrap script. Do not include '--kubelet-extra-args', see files/bootstrap.sh in https://github.com/awslabs/amazon-eks-ami
see: https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh
Example: --use-max-pods false --enable-docker-bridge true
AditionalExtraArguments:
Type: String
Default: ""
Description: |
Aditional --kubelet-extra-args arguments, do not include labels or taints
see: https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh
Example: --system-reserved=memory=1Gi --kube-reserved=memory=256Mi I've checked the file [root@ip-10-60-16-95 log]# cat /etc/systemd/system/kubelet.service.d/30-kubelet-extra-args.conf
[Service]
Environment='KUBELET_EXTRA_ARGS=--system-reserved=memory=1Gi --kube-reserved=memory=256Mi --node-labels=aws.eks.cluster=staging-01,aws.eks.nodegroup=sad-01,custom.workload.type=monitoring,custom.company=SomeCompany --register-with-taints="dedicated=monitoring:NoSchedule"'
This is not the best way to solve it, but maybe work for you |
Hi,
This works for me. |
This appears to be resolved. |
What happened:
I dont see the taints happening but can find the labels got modified on the nodes whjich is good. But I dont see the nodes got tainted as I was expecting.
What you expected to happen:
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
Environment:
aws eks describe-cluster --name <name> --query cluster.platformVersion
):aws eks describe-cluster --name <name> --query cluster.version
):uname -a
):cat /tmp/release
on a node):The text was updated successfully, but these errors were encountered: