码迷,mamicode.com
首页 > Web开发 > 详细

Kubernetes学习(七)

时间:2020-02-18 20:44:45      阅读:96      评论:0      收藏:0      [点我收藏+]

标签:解析   content   机器   pre   static   cas   strong   ati   VID   

 Ingress

一、资料信息

Ingress-Nginx github 地址:https://github.com/kubernetes/ingress-nginx

Ingress-Nginx 官方网站:https://kubernetes.github.io/ingress-nginx/

进入官方下载

wget https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml

技术图片

 

 

 技术图片

二、部署 Ingress-Nginx

https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.28.0/deploy/static/provider/baremetal/service-nodeport.yaml
https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml

kubectl apply -f mandatory.yaml

kubectl apply -f service-nodeport.yaml

Ingress HTTP 代理访问

deployment、Service、Ingress Yaml 文件

apiVersion: extensions/v1beta1

 

kind: Deployment

metadata:

name: nginx-dm

spec:

  replicas: 2

template:

 metadata:

labels:

 name: nginx

 spec:

 containers:

 - name: nginx

 image: wangyanglinux/myapp:v1

 imagePullPolicy: IfNotPresent

 ports:

 - containerPort: 80

 

 

apiVersion: v1

kind: Service

metadata:

 name: nginx-svc

spec:

 ports:

 - port: 80

 targetPort: 80

 protocol: TCP

 selector:

 name: nginx

 

 

apiVersion: extensions/v1beta1

kind: Ingress

metadata:

   name: nginx-test

spec:

 rules:

- host: www1.atguigu.com

 http:

paths:

 - path: /

backend:

 serviceName: nginx-svc

 servicePort: 80

过程如下

1.执行
mandatory.yaml
2.执行
service-nodeport.yaml
3.执行deployment
deployment.yaml
4.执行ingress
ingress.http.yaml

master机器解析IP后可以通过 curl 访问但是本机解析后通过浏览器访问大部分都是失败的,原因未知

 

Kubernetes学习(七)

标签:解析   content   机器   pre   static   cas   strong   ati   VID   

原文地址:https://www.cnblogs.com/lovedairan/p/12287709.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!