k8s安装之nginx.yaml
这里两个nginx。一个是用来测试最简单的集群的。
另一个是用来作grafana,prometheus,dashboard前端安全展示的。
简单版
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1
selector:
matchLabels:
name: nginx
template:
metadata:
labels:
name: nginx
spec:
containers:
- name: nginx
image: harbor.xxx.cn/official_hub/nginx:1.13-alpine
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: nginx-service-nodeport
spec:
ports:
- port: 80
targetPort: 80
protocol: TCP
type: NodePort
selector:
name: nginx
前端安全版:
---
apiVersion: v1
kind: ConfigMap
metadata:
name: proxy-nginx
namespace: kube-system
data:
default.conf: |-
upstream prometheus {
server prometheus:9090;
}
upstream grafana {
server monitoring-grafana:80;
}
upstream dashboard {
server 1.2.3.4:32766;
}
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /check {
default_type text/plain;
return 200 "serving is ok!";
}
location /status {
stub_status on;
access_log off;
}
location /prometheus {
proxy_pass http://prometheus;
proxy_set_header Host $host;
}
location /grafana {
proxy_pass http://grafana;
rewrite ^/grafana/(.*) /$1 break;
proxy_set_header Host $host;
}
location /dashboard {
auth_basic "Password please";
auth_basic_user_file /etc/nginx/conf.d/nginx_passwd;
proxy_pass http://dashboard;
rewrite ^/dashboard/(.*) /$1 break;
proxy_set_header Host $host;
}
# redirect server error pages to the static page /50x.html
# chengang from k8s config map file
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
nginx_passwd: |-
admin:xxxxxxxxxxxxxxxxxxxxxxxxx
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: proxy-nginx
namespace: kube-system
spec:
replicas: 1
template:
metadata:
labels:
k8s-app: proxy-nginx
spec:
containers:
- name: nginx
image: harbor.xxx.cn/official_hub/nginx:1.13-alpine
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80
protocol: TCP
volumeMounts:
- name: nginx-conf
mountPath: /etc/nginx/conf.d
volumes:
- name: nginx-conf
configMap:
name: proxy-nginx
nodeSelector:
node-role.kubernetes.io/master: ""
tolerations:
- key: "node-role.kubernetes.io/master"
effect: "NoSchedule"
---
apiVersion: v1
kind: Service
metadata:
name: proxy-nginx
namespace: kube-system
spec:
type: NodePort
ports:
- port: 80
targetPort: 80
nodePort: 32767
selector:
k8s-app: proxy-nginx
k8s安装之nginx.yaml的更多相关文章
- k8s安装之dashboard.yaml
这个我使用了nodeport方式导出来. 为了安装,最好在前面加个nginx作密码验证... 这个端口,可以通过防火墙禁掉. # Copyright 2017 The Kubernetes Autho ...
- k8s安装之prometheus.yaml
这个系列的东东满多的.要另开系列说明. 这里为了内容连续完成,先贴一个吧,其它configmap,exporter就不展示. 为了保持统一,将prometheus也放到二级目录了. - '--web. ...
- k8s安装之calico.yaml
这个calico有点长,我也没有仔细看完. 但部署上去是可用的. 如果节点超过200台,那最好要另外一套配置... 而对于我们,差不多下面的配置够用了. veth_mtu: "1440&qu ...
- k8s安装之node-autoapprove-certificate-server.yaml
kubelet证书分为server和client两种, k8s 1.9默认启用了client证书的自动轮换,但server证书自动轮换需要用户开启.方法是: 2.1 增加 kubelet 参数(现已默 ...
- k8s安装之eventrouter.yaml
k8s的heapster项目中止以后, 事件收集的项目,就推荐使用https://github.com/heptiolabs/eventrouter项目了 Eventrouter This repos ...
- k8s安装之kube-state-metrics.yaml
概述 已经有了cadvisor.heapster.metric-server,几乎容器运行的所有指标都能拿到,但是下面这种情况却无能为力: 我调度了多少个replicas?现在可用的有几个? 多少个P ...
- k8s安装之grafana.yaml
这个作展示,够用. 为了使用nginx统一管理, 这里将grafana放在子目录下. - name: GF_SERVER_ROOT_URL value: "%(protocol)s://% ...
- k8s安装之flannel.yaml
收藏一下,以后直接从这里cp过来用的. flannel新版 --- apiVersion: extensions/v1beta1 kind: PodSecurityPolicy metadata: n ...
- k8s安装ingress
1. 环境准备 安装nginx-ingress-controller和backend cd /etc/yum.repos.d/mainfests 下载镜像的脚本 vi ingressnginx.sh ...
随机推荐
- [LeetCode] 350. Intersection of Two Arrays II 两个数组相交II
Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1 ...
- STM32F405的内部ADC采集
1. ADC的初始化部分基本一致,下面是引脚复用配置 void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc) { GPIO_InitTypeDef GPIO_Ini ...
- 在ObjectARX中创建OPM项目的时候出现 MIDL1012: argument illegal for switch / header错误的解决方式
修改为 这样新建的带有MIDL项目就不会提示错误这个错误了. 如果你已经建立好项目,可以尝试修改MIDL的配置,头文件可能是.h没有文件名,所以出现MIDL1012错误,修改为项目名称的.h即可,保持 ...
- [转帖]DCEP究竟是什么?
DCEP究竟是什么? https://www.cnblogs.com/kaixin2018/p/11795534.html DCEP (Digital Currency Electronic Paym ...
- [CMD] 批处理
https://www.tutorialspoint.com/batch_script/batch_script_commands.htm
- spring框架学习(三)——AOP( 面向切面编程)
AOP 即 Aspect Oriented Program 面向切面编程 首先,在面向切面编程的思想里面,把功能分为核心业务功能,和周边功能. 所谓的核心业务,比如登陆,增加数据,删除数据都叫核心业务 ...
- @PostConstruct使用总结
https://blog.csdn.net/qq_37636695/article/details/84791468 https://www.jianshu.com/p/aba99a49a459 @P ...
- Vue通过WebSocket建立长连接
使用场景: 在项目开发中,后端需要处理一连串的逻辑,或者等待第三方的数据返回来进行处理之后在返回给前端,可能时间会很长,而且前端也不知道后端什么时候能处理好(时间长的话会达到10分钟左右),如果采用普 ...
- 使用vue脚手架搭建项目并将px自动转化为rem
一.安装node.js环境 二.node.js安装完成后使用npm安装vue脚手架vue-cli和安装webpack,我这里用cnpm cnpm i @vue/cli -g //全局安装脚手架3.0 ...
- 使用gulp构建项目
gulp.js作为一个前端构建工具,类似于webpack.Grountjs.rollupjs,不过相对于其他几种打包工具,gulp的使用更轻量,配置更简单,打包速度更快,今天不说他们几个的区别,也不说 ...