我正在尝试在kubernetes上部署nginx,kubernetes版本是v1.5.2,我已经部署了3个副本的nginx,YAML文件在下面,
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: deployment-example
spec:
replicas: 3
revisionHistoryLimit: 2
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.10
ports:
- containerPort: 80
Run Code Online (Sandbox Code Playgroud)
现在我想在节点的端口30062上公开它的端口80,因为我在下面创建了一个服务,
kind: Service
apiVersion: v1
metadata:
name: nginx-ils-service
spec:
ports:
- name: http
port: 80
nodePort: 30062
selector:
app: nginx
type: LoadBalancer
Run Code Online (Sandbox Code Playgroud)
这项服务应该是合理的,但它不仅在终端上的kubernetes仪表板上显示为待定.


所以请帮我解决这个问题.谢谢 ...
我想对MicroK8做两件事:
我的最终目标是创建一个位于Ubuntu主机上的单节点Kubernetes集群,然后使用入口将不同的域路由到服务中各自的Pod。
在过去的几天里,我一直在尝试使用Microk8s进行此操作,但是我无法解决这个问题。
到目前为止,我得到的最好的结果是使用MetalLB创建负载均衡器。但这要求我使用本地网络上可用的免费IP地址,而不要使用主机IP地址。
我还启用了,default-http-backend并尝试导出和编辑这些配置文件,但均未成功。
作为示例,Minikube一旦启用了入口添加功能,它将可以正常工作。此示例显示了群集IP上端口80处的基本Nginx服务器映像:
# ingress-service.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress-service
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
# - host: nginx.ioo
- http:
paths:
- path: /
backend:
serviceName: nginx-cluster-ip-service
servicePort: 80
Run Code Online (Sandbox Code Playgroud)
# nginx-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 1
selector:
matchLabels:
component: nginx
template:
metadata:
labels:
component: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: …Run Code Online (Sandbox Code Playgroud)