我正在尝试将其他用户数据传递给部署在 AWS 上的 k8s 集群中的节点。为此,我编辑了 IG“节点”并将配置设置为此...
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
但它不起作用。不生成错误日志。甚至不知道如何开始调试此问题。AdditionalUserData
没有该字段,一切正常。