无法通过kops编辑在实例组中提供其他用户数据

时间:2018-02-08 08:02:21

标签: kubernetes kops

我试图将其他用户数据传递到AWS上部署的k8s群集中的节点。为此,我编辑了IG节点'并将配置设置为此...

awk '
  BEGIN { OFS=FS=":" } 
  NR==FNR { split ($3,one,":"); two[$1] = one[1]; next } 
  $1 in two { $1 = two[$1]; print }' input.txt >> output.txt

但它不起作用。不会生成错误日志。不知道如何开始调试此问题。 没有apiVersion: kops/v1alpha2 kind: InstanceGroup metadata: creationTimestamp: 2018-02-07T13:25:13Z labels: kops.k8s.io/cluster: example.com name: nodes spec: image: kope.io/k8s-1.7-debian-jessie-amd64-hvm-ebs-2018-01-14 machineType: xx.xxx maxPrice: "xx.xx" maxSize: x minSize: y role: Node subnets: - xx-xxxx-xx additionalUserData: - name: myscript.sh type: text/x-shellscript content: | #!/bin/sh echo "xx.xxx.xxx.xx us-east-1a.fs-xxxxxx.efs.us-east-1.amazonaws.com" >> /etc/hosts echo "x.xx.xxx.xx us-east-1b.fs-xxxxx.efs.us-east-1.amazonaws.com" >> /etc/hosts echo "xxxx.xx.xxx.xxx us-east-1c.fs-xxxx.efs.us-east-1.amazonaws.com" >> /etc/hosts mkdir -p /opt/pvs echo "$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone).fs-xxxxx.efs.us-east-1.amazonaws.com:/ /opt/pvs nfs4 nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 0 0" >> /etc/fstab 字段,一切正常。

1 个答案:

答案 0 :(得分:0)

尝试

spec:
  additionalUserData:
  - content: |
      #!/bin/bash
      apt update
      apt install -y jq awscli
      mkdir -p /opt/pvs
      INSTANCE_ID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)
    name: assign-eip.sh
    type: text/x-shellscript