我尝试了kubernetes并且一直在尝试部署一个简单的tomcat图像
apiVersion: apps/v1
kind: Deployment
metadata:
name: simple-hello
labels:
app: hello-tomcat
spec:
replicas: 1
selector:
matchLabels:
app: hello-tomcat
template:
metadata:
labels:
app: hello-tomcat
spec:
containers:
- name: helloworld
image: tomcat:8.0.52-jre8
ports:
- containerPort: 8080
protocol: TCP
部署之后,我只是公开它
kubectl公开部署simple-hello --type = LoadBalancer --name =我的服务
我也试过
kubectl公开部署simple-hello --type = LoadBalancer --name = my-service --port 80 --target-port 8080
我看到播放设备已启动,我也收到了网址,但是当我尝试点击该网址时,我没有得到任何回复。
my-service输出描述如下
Name: my-service
Namespace: default
Labels: app=hello-tomcat
Annotations: <none>
Selector: app=hello-tomcat
Type: LoadBalancer
IP: 100.64.42.168
LoadBalancer Ingress: a5c67f4526eb811e881a24e712271c17-2052164901.eu-central-1.elb.amazonaws.com
Port: <unset> 8080/TCP
TargetPort: 8080/TCP
NodePort: <unset> 31545/TCP
Endpoints: 100.96.0.14:8080
Session Affinity: None
External Traffic Policy: Cluster
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal EnsuringLoadBalancer 45s service-controller Ensuring load balancer
Normal EnsuredLoadBalancer 43s service-controller Ensured load balancer
如果我在docker中运行此图像,我期待至少看到tomcats登陆页面。
我错过了什么?