[英]unable to access the application deployed on kubernetes cluster using kubernetes playground
I have a 3 node cluster created on kubernetes playground 我在kubernetes操场上创建了一个3节点集群
The 3 nodes as seen on the UI are : 在UI上看到的3个节点是:
192.168.0.13 : Master
192.168.0.12 : worker
192.168.0.11 : worker
I have a front end app connected to backend mysql. 我有一个连接后端MySQL的前端应用程序。
The deployment and service definition for front end is as below. 前端的部署和服务定义如下。
apiVersion: v1
kind: Service
metadata:
name: springboot-app
spec:
type: NodePort
ports:
- port: 8080
selector:
app: springboot-app
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: springboot-app
spec:
replicas: 3
selector:
matchLabels:
app: springboot-app
template:
metadata:
labels:
app: springboot-app
spec:
containers:
- image: chinmayeepdas/springbootapp:1.0
name: springboot-app
env:
- name: DATABASE_HOST
value: demo-mysql
- name: DATABASE_NAME
value: chinmayee
- name: DATABASE_USER
value: root
- name: DATABASE_PASSWORD
value: root
- name: DATABASE_PORT
value: "3306"
ports:
- containerPort: 8080
name: app-port
My PODs for UI and backend are up and running. 我的UI和后端POD已启动并正在运行。
[node1 ~]$ kubectl describe service springboot-app
Name: springboot-app
Namespace: default
Labels: <none>
Annotations: <none>
Selector: app=springboot-app
Type: NodePort
IP: 10.96.187.226
Port: <unset> 8080/TCP
TargetPort: 8080/TCP
NodePort: <unset> 30373/TCP
Endpoints: 10.32.0.2:8080,10.32.0.3:8080,10.40.0.3:8080
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>
Now when i do, 现在当我这样做时
http://192.168.0.12:30373/employee/getAll http://192.168.0.12:30373/employee/getAll
I dont see any result. 我没有看到任何结果。 I get This site can't be reached
我知道无法访问此网站
What IP address i have to give in the URL? 我必须在URL中提供什么IP地址?
try this solution 试试这个解决方案
kubectl proxy --address 0.0.0.0
Then access it as http://localhost:30373/employee/getAll 然后以http:// localhost:30373 / employee / getAll的身份访问它
or maybe: 或者可能:
http://localhost:8080/employee/getAll HTTP://本地主机:8080 /员工/ GETALL
let me know if this fixes the access issue and which one works. 让我知道这是否解决了访问问题以及哪个可行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.