kubernetes/kops

kops 1.25: AWS InstanceGroupSpec.InstanceMetadataOptions.HttpTokens is NOT required by default

Opened this issue · 3 comments

/kind bug

1. What kops version are you running? The command kops version, will display
this information.

$ kops version
Client version: 1.25.4 (git-v1.25.4)

2. What Kubernetes version are you running? kubectl version will print the
version if a cluster is running or provide the Kubernetes version specified as
a kops flag.

$ kubectl version
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.  Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.13", GitCommit:"5244794d27b4cc68290bc496b00e248857ac8b47", GitTreeState:"clean", BuildDate:"2023-08-24T00:01:27Z", GoVersion:"go1.20.7", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.7
Server Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.13", GitCommit:"5244794d27b4cc68290bc496b00e248857ac8b47", GitTreeState:"clean", BuildDate:"2023-08-23T23:54:36Z", GoVersion:"go1.20.7", Compiler:"gc", Platform:"linux/amd64"}

3. What cloud provider are you using?
AWS

4. What commands did you run? What is the simplest way to reproduce this issue?

$ cat test.yaml
apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
metadata:
  labels:
    kops.k8s.io/cluster: xyz
  name: mytest-IG
spec:
  associatePublicIp: false
  cloudLabels:
    K8sClusterType: Kops
    k8s.io/cluster-autoscaler: enabled
  image: ami-0384f963b10435324
  machineType: m5.large
  maxSize: 5
  minSize: 1
  nodeLabels:
    node-role: my-misc
  role: Node
  rootVolumeOptimization: true
  rootVolumeSize: 30
  subnets:
  - us-east-1a
  - us-east-1b
  - us-east-1c
  taints:
  - dedicated=my-misc:NoSchedule

kops create -f test.yaml

5. What happened after the commands executed?

mytest-IG created an AWS instance **without** setting instanceMetadata.httpTokens as required.

6. What did you expect to happen?

if cluster.IsKubernetesGTE("1.22") {

mytest-IG will create an AWS instance **with** setting instanceMetadata.httpTokens as required.

7. Please provide your cluster manifest. Execute
kops get --name my.example.com -o yaml to display your cluster manifest.
You may want to remove your cluster name and other sensitive information.

any k8s cluster

8. Please run the commands with most verbose logging by adding the -v 10 flag.
Paste the logs into this report, or in a gist and provide the gist link here.

maybe not need now, mainly a question to confirm.

9. Anything else do we need to know?

maybe not need now, mainly a question to confirm.

@xqzhang2015 Could you try using the latest kOps release?

@hakman Yes, I could.
Here I'm just curious about how the mechanism/code works here(in 1.25), which maybe I don't know about it thoroughly.

@hakman Yes, I could. Here I'm just curious about how the mechanism/code works here(in 1.25), which maybe I don't know about it thoroughly.

Based on what I see in 1.25 code, should be part of the IG spec. In later kOps versions, it is implicit.