Generate monitoring dashboards & alertings using Grafana API

Generate monitoring dashboards & alertings using Grafana API

Grafana has been adopted as a common monitoring dashboard by more and more companies, in many cases, when operators need to create dashboard repeatedly they either choose to use template variables or create dashboards one by one. I think it’s very useful to leverage the Grafana API to generate the monitoring dashboards automatically from template.

Read more
How to install Spinnaker on CentOS 7

How to install Spinnaker on CentOS 7

Spinnaker doesn’t support installation on CentOS machine, this article introduces how to use Docker to install Spinnaker components on CentOS directly.

As we know, according to the spinnaker’s official documentation, spinnaker provides a tool for installing the spinnaker cluster in Kubernetes cluster or debian/ubuntu bare metal machine, but there’s not an option to install it on CentOS or other common operating systems. Althogh the spinnaker provides a way to start Spinnaker with Docker Compose, but it’s out of date. So I created a new docker-compose project to quickstart a spinnaker cluster on any kind of os.

Read more
How to host Swagger documentation using yaml/json configuration files?
My first Hackathon: bring Spinnaker to my company

My first Hackathon: bring Spinnaker to my company

I’ve joined my first Hackathon and worked on a project about using Spinnaker as CI/CD tool within company. The biggest challenge is to install Spinnaker on CentOS 7 with docker-compose.

Why Spinnaker?

  • Spinnaker is dedicated to deploy services across multiple cloud providers and the integration with AWS, GCP, Azure is out of box.
  • It’s focused on deploy stably, support full control of workflow, developers can customize the deployment flow to improve the quality of deployment, also it’s automatic.
  • You will have a Web UI.
Read more

Istio Version Control On Kubernetes

Istio has been adopted as a common implementation of service mesh, since more and more companies want to bring Istio into production, the version control of Istio seems a significant problem to solve.

Version control is necessary as Istio components can be treated as the equivalent RPC services like our business services, we need to have an understanding of which version we are using now and what does the next version bring. And some Istio components can cooperate with the others, if we need to upgrade one component we need to upgrade the other components too.

Although the Istio community provides the Istio upgrade method, we don’t actually want to upgrade such a whole thing in one move, it influences so much that we don’t want to risk.

Read more
Kubernetes DNS拓展

Kubernetes DNS拓展

Kubernetes DNS在内部服务与外部服务交互,内部服务与内部服务,内部服务与云托管服务交互的工具,拓展DNS可以在内部服务访问集群外服务时像访问集群内服务一样,通过DNS映射将统一风格的域名映射到可访问的IP,而不需要影响内部服务的运行,这里介绍如何使用Consul来拓展DNS。

Read more
以Kubernetes sidecar方式部署Nginx: 提供更好的Web性能

以Kubernetes sidecar方式部署Nginx: 提供更好的Web性能

Web server’s gzip

Web服务开启数据压缩,有利于节省带宽。服务器根据客户端请求头所带的Accept-Encoding判断是否需要对返回数据进行压缩,通常支持的压缩格式是gzip。

应用gzip or Nginx gzip

开发人员可以选择在Web framework中开发一些middleware来实现Gzip,也可以选择使用Nginx gzip,将所有gzip放在nginx中完成。

放在nginx中实现的优势是nginx中gzip性能优秀,能很大程度地减少gzip带来的消耗,像Golang中系统自带库中实现的gzip性能上相比nginx就差很多,并且需要使用对象池进行优化,避免每次创建gzip对象带来的性能损耗,在CPU和内存上占用较大。

使用Nginx gzip替代应用gzip

如果使用Nginx实现的gzip,那么部署的时候可以有几种方案。

  1. 集中式nginx集群
    nginx集中部署,通过配置反向代理服务各种应用,优势是部署方便,集中管理。劣势是更新路由也是牵一发动全身,并且需要及时拓容。

  2. 每个实例搭配nginx
    原本对外暴露的应用现在通过nginx代理,1:1的方式部署,不用担心拓容的问题。需要解决的就是如何保证它们打包部署。

Sidecar in Kubernetes

这里讨论Kubernetes中部署Web服务的情况,遇到刚才的方案二,可以在Kubernetes中找到非常匹配的部署方法。

Kubernetes中最小部署单位称为Pod,Pod中可以部署1个以上的功能紧密联系的容器,并且它们共享网络、磁盘,也就是它们能通过localhost:port访问到彼此,那以上的情况nginx作为gzip功能可以说和后端应用是紧密结合,所以可以以sidecar的形式部署。

Nginx配置

如果你的应用监听在8080端口,nginx监听在8090,可以如下配置

/etc/nginx/site.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
user  nginx;
worker_processes 1;

events {
worker_connections 1024;
}

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
keepalive_timeout 65;

gzip on;
gzip_min_length 256;
gzip_types application/javascript application/json text/css text/plain;

include /etc/nginx/conf.d/*.conf;
}
/etc/nginx/conf.d/site.conf
1
2
3
4
5
6
7
8
server {
listen 8090;

location / {
proxy_pass http://127.0.0.1:8088/;
proxy_set_header Host $http_host;
}
}

参考

  1. Use of pods
  2. Nginx gzip
  3. HTTP Accept-Encoding
Ansible常用命令
etcd生产环境实践

etcd生产环境实践

生产环境搭建etcd

以搭建3节点高可用ETCD集群为例,分别在三台主机上初始化ETCD1,ETCD2,ETCD3作为机器IP地址。

Read more

基于gitlab搭建CI

自建gitlab

自建gitlab一大优势是,之前用翻墙走github速度也在1M/s左右,可是自建的gitlab提升了建立连接的速度,可以说体验又上升了一个档次。

用docker起一个gitlab服务尤其方便 GitLab Docker images

Read more
Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×