【发布时间】:2020-01-10 22:46:03
【问题描述】:
我的系统中有Pod 和Service ymal 文件。我想使用kubectl create -f <file> 运行这两个并从外部浏览器连接以测试连接性。这是我所遵循的。
我的豆荚:
apiVersion: v1
kind: Pod
metadata:
name: client-nginx
labels:
component: web
spec:
containers:
- name: client
image: nginx
ports:
- containerPort: 3000
我的服务文件:
apiVersion: v1
kind: Service
metadata:
name: client-nginx-port
spec:
type: NodePort
ports:
- port: 3050
targetPort: 3000
nodePort: 31616
selector:
component: web
我使用了kubectl create -f my_pod.yaml,然后kubectl get pods 显示了我的pod client-nginx
然后kubectl create -f my_service.yaml,这里没有错误,然后显示所有服务。
当我尝试卷曲服务时,它给出了
curl: (7) 连接 192.168.0.10 端口 31616 失败:连接被拒绝。
kubectl get deployments 不显示我的 pod。我必须部署它吗?我有点困惑。如果我使用指令given here,I can deploynginxsuccessfully and access from outside browsers.
我使用指令given here 对此进行了测试。
【问题讨论】:
-
尝试使用服务 IP 和端口,而不是 pod IP。
-
@PrateekSen 不走运,同样的结果。
标签: nginx kubernetes kubectl kube-controller-manager