Kubernetes 服务外部 ip 待处理

编程入门 行业动态 更新时间:2024-10-24 14:26:17
本文介绍了Kubernetes 服务外部 ip 待处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试在 kubernetes 上部署 nginx,kubernetes 版本是 v1.5.2,我已经部署了 3 个副本的 nginx,YAML 文件在下面,

I am trying to deploy nginx on kubernetes, kubernetes version is v1.5.2, I have deployed nginx with 3 replica, YAML file is below,

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

现在我想在节点的端口 30062 上公开它的端口 80,为此我在下面创建了一个服务,

and now I want to expose its port 80 on port 30062 of node, for that I created a service below,

kind: Service apiVersion: v1 metadata: name: nginx-ils-service spec: ports: - name: http port: 80 nodePort: 30062 selector: app: nginx type: LoadBalancer

该服务运行良好,但它不仅在 kubernetes 仪表板上显示为待处理,在终端上也显示为挂起.

this service is working good as it should be, but it is showing as pending not only on kubernetes dashboard also on terminal.

推荐答案

看起来您正在使用自定义 Kubernetes 集群(使用 minikube、kubeadm 等).在这种情况下,没有集成 LoadBalancer(与 AWS 或 Google Cloud 不同).使用此默认设置,您只能使用 NodePort 或入口控制器.

It looks like you are using a custom Kubernetes Cluster (using minikube, kubeadm or the like). In this case, there is no LoadBalancer integrated (unlike AWS or Google Cloud). With this default setup, you can only use NodePort or an Ingress Controller.

使用 Ingress Controller,您可以设置域映射到您的 pod 的名称;如果您使用入口控制器,则不需要为您的服务提供 LoadBalancer 类型.

With the Ingress Controller you can setup a domain name which maps to your pod; you don't need to give your Service the LoadBalancer type if you use an Ingress Controller.

更多推荐

Kubernetes 服务外部 ip 待处理

本文发布于:2023-11-09 20:26:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1573350.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Kubernetes   ip

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!