Task
重新配置 spline-reticulator namespace 中现有的 front-end Deployment,以公开现有容器 nginx 的端口 80/tcp
创建一个名为 front-end-svc 的新 Service ,以公开容器端口 80/tcp
配置新的 Service ,以通过 NodePort 公开各个 Pod
< 2 > 在线修改 front-end Deployment
kubectl -n spline-reticulator edit deployment front-end
bash
...
template:
...
spec:
containers:
- image: nginx
# 暴露容器的80端口(TCP)
ports:
- containerPort: 80
protocol: TCP
...
提示 edited,表示修改成功
< 3 > 使用 NodePort 类型,暴露 80/tcp 端口
kubectl -n spline-reticulator expose deployment front-end --type=NodePort --port=80 --target-port=80 --name=front-end-svc
提示 exposed,表示创建 svc 成功
< 4 > 最后 curl 检查 svc
kubectl -n spline-reticulator get svc front-end-svc -o wide