Kubernetes 服务外部 ip 待处理 [英] Kubernetes service external ip pending

查看:25
本文介绍了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 集群(使用 minikubekubeadm 等).在这种情况下,没有集成 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 待处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆