3.3. 为 AWS 启用端口
您必须启用端口 15150 和 9000,以允许内部与 AWS 上运行的对等 pod 通信。
先决条件
- 已安装 OpenShift 沙盒容器 Operator。
- 已安装 AWS 命令行工具。
-
您可以使用具有
cluster-admin角色的用户访问集群。
流程
登录您的 OpenShift Container Platform 集群并检索实例 ID:
$ INSTANCE_ID=$(oc get nodes -l 'node-role.kubernetes.io/worker' \ -o jsonpath='{.items[0].spec.providerID}' | sed 's#[^ ]*/##g')检索 AWS 区域:
$ AWS_REGION=$(oc get infrastructure/cluster -o jsonpath='{.status.platformStatus.aws.region}')检索安全组 ID,并将其存储在阵列中:
$ AWS_SG_IDS=($(aws ec2 describe-instances --instance-ids ${INSTANCE_ID} \ --query 'Reservations[*].Instances[*].SecurityGroups[*].GroupId' \ --output text --region $AWS_REGION))对于每个安全组 ID,授权 peer pod shim 访问 kata-agent 通信,并设置对等 pod 隧道:
$ for AWS_SG_ID in "${AWS_SG_IDS[@]}"; do \ aws ec2 authorize-security-group-ingress --group-id $AWS_SG_ID --protocol tcp --port 15150 --source-group $AWS_SG_ID --region $AWS_REGION; \ aws ec2 authorize-security-group-ingress --group-id $AWS_SG_ID --protocol tcp --port 9000 --source-group $AWS_SG_ID --region $AWS_REGION; \ done
现在启用这些端口。