如何在EKS启动模板Bootstrap脚本中安装其他软件包?
我为我的EKS节点组启动模板提供了此Bootstrap脚本,并在一些命令中添加了尝试安装Apache。我尝试了一些变体,没有一个可以安装服务。如果我进入我的节点,我可以手动执行此操作,但是无法用脚本
bootstrap.sh
变化#1
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="==MYBOUNDARY=="
--==MYBOUNDARY==
Content-Type: text/x-shellscript; charset="us-ascii"
#!/bin/bash
set -ex
/etc/eks/bootstrap.sh ${cluster_name} \
--container-runtime containerd
sudo su
yum update -y
yum install httpd -y
service httpd start
--==MYBOUNDARY==--
来完成它。变体#2
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="==MYBOUNDARY=="
--==MYBOUNDARY==
Content-Type: text/x-shellscript; charset="us-ascii"
#!/bin/bash
sudo su
yum update -y
yum install httpd -y
service httpd start
set -ex
/etc/eks/bootstrap.sh ${cluster_name} \
--container-runtime containerd
--==MYBOUNDARY==--
变量#3
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="==MYBOUNDARY=="
--==MYBOUNDARY==
Content-Type: text/x-shellscript; charset="us-ascii"
#!/bin/bash
set -ex
/etc/eks/bootstrap.sh ${cluster_name} \
--container-runtime containerd
--==MYBOUNDARY==--
#!/bin/bash
sudo su
yum update -y
yum install httpd -y
service httpd start
我也尝试过有没有sudo su
,而这些都没有使用。似乎这些命令根本没有运行
I have this bootstrap script for my EKS node-group launch template and I added in some commands to try to install Apache. I tried a few variations and none would install the service. I'm able to do it manually if I ssh into my nodes, but haven't been able to accomplish it with my script
bootstrap.sh
Variation #1
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="==MYBOUNDARY=="
--==MYBOUNDARY==
Content-Type: text/x-shellscript; charset="us-ascii"
#!/bin/bash
set -ex
/etc/eks/bootstrap.sh ${cluster_name} \
--container-runtime containerd
sudo su
yum update -y
yum install httpd -y
service httpd start
--==MYBOUNDARY==--
Variation #2
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="==MYBOUNDARY=="
--==MYBOUNDARY==
Content-Type: text/x-shellscript; charset="us-ascii"
#!/bin/bash
sudo su
yum update -y
yum install httpd -y
service httpd start
set -ex
/etc/eks/bootstrap.sh ${cluster_name} \
--container-runtime containerd
--==MYBOUNDARY==--
Variation #3
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="==MYBOUNDARY=="
--==MYBOUNDARY==
Content-Type: text/x-shellscript; charset="us-ascii"
#!/bin/bash
set -ex
/etc/eks/bootstrap.sh ${cluster_name} \
--container-runtime containerd
--==MYBOUNDARY==--
#!/bin/bash
sudo su
yum update -y
yum install httpd -y
service httpd start
I also tried with and without the sudo su
and none of those worked either. Just seems like the commands aren't running at all
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我只是在启动模板的
userData
中使用以下代码。这从来都不是问题。它在 ec2&gt下;启动模板> (您的启动模板)>详细信息>高级详细信息
屏幕快照参考
aws ec2 ec2启动模板用户数据
I simply used the below code in the
userdata
of the launch template & it was never a problem.It's Under EC2 > Launch Templates > (your launch template) > Details > Advanced Details
Screenshot Reference
AWS EC2 Launch Template User Data