我正在尝试在 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 待处理
发布评论