linux 创建本地源

linux 创建本地源 ubuntu 创建 local repo 将包放在 debs 目录下, 使用如下命令创建 私有仓库索引 1 2 3 cd /data/repo dpkg-scanpackages debs/ /dev/null |gzip > debs/Packages.gz centos 创建 local repo 将包放在 /data/repo/centos7 目录下, 使用如下命令创建 私有仓库索引 1 2 3 cd /data/repo/centos7 createrepo .……

阅读全文

使用 lego 申请 let's encrypt 证书

使用 lego 申请 let’s encrypt 证书 lego 是用来申请 let's encrypt 免费证书的, 现在支持多种验证方式。 以下是使用 alidns 解析验证。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 #!/bin/bash # # lego-letsencrypt.sh # cd $(dirname $0) which lego || { lego_ver=v3.7.0 wget -c https://github.com/go-acme/lego/releases/download/${lego_ver}/lego_${lego_ver}_linux_amd64.tar.gz -o lego.tar.gz tar xf lego.tar.gz cp -a lego /usr/local/bin/lego } DomainList="*.example.com,*.example.org" EMAIL="[email protected]" export ALICLOUD_ACCESS_KEY=LTAxxxxxx export ALICLOUD_SECRET_KEY=yyyyyyyyyyyyyyyyy Domains="" for domain in ${DOMAINs//,/ } do { Domains="${Domains} --domain=${domain}" }……

阅读全文

calico 配置 BGP Route Reflectors

calico 配置 BGP Route Reflectors Calico作为k8s的一个流行网络插件,它依赖BGP路由协议实现集群节点上的POD路由互通;而路由互通的前提是节点间建立 BGP Peer 连接。BGP 路由反射器(Route Reflectors,简称 RR)可以简化集群BGP Peer的连接方式,它是解决BGP扩展性问题的有效方式;具……

阅读全文

calico 网络模型的简单笔记

calico 简单笔记 calico 是一种基础 vRouter 的3层网络模型 (BGP 网络)。 在应用到 k8s 中,可以提到常见的 flannel。 使用节点主机作为 vRouter 实现 3层转发。 提高网络性能。 calico 的网络模型 calico 可以通过设置 IP-in-IP 控制网络模型: https://docs.projectcalico.org/v3.5/usage/configuration/ip-in-ip ipipMode=Never: BGP 模型。 完全不使用 IP-in-IP 隧道, 这就是常用的 BGP 模型。 ipipMode=Always: calico 节点直接通过 IP 隧道的的方式实现节点互通。 这实际……

阅读全文

k8s nginx ingress 添加 x-forwarded

ingress 配置 for-forward-for The client IP address will be set based on the use of PROXY protocol or from the X-Forwarded-For header value when use-forwarded-headers is enabled. https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#use-forwarded-headers https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#forwarded-for-header 1 2 3 4 5 6 7 8 apiVersion: extensions/v1beta1 kind: Ingress metadata: name: srv-bff-op-center annotations: nginx.ingress.kubernetes.io/forwarded-for-header: "X-Forwarded-For" kubernetes.io/ingress.class: "nginx"……

阅读全文

dokcer daemon.json

docker daemon.json 配置文件 daemon.json 配置方式 Linux: /etc/docker/daemon.json Windows Server: C:\ProgramData\docker\config\daemon.json Docker for Mac / Docker for Windows: Click the Docker icon in the toolbar, select Preferences, then select Daemon. Click Advanced. daemon.json 配置 镜像加速器 1 2 3 4 5 6 7 8 9 // 配置一个 { "registry-mirrors": ["https://registry.docker-cn.com"] } // 配置多个 { "registry-mirrors": ["https://registry.docker-cn.com","https://docker.mirrors.ustc.edu.cn"] } 镜像加速器常用值: docker-cn 官方 : https://registry.docker-cn.com 中科大 : https://docker.mirrors.ustc.edu.cn 日志 1 2 3 4 { "debug": true, "log-level": "info" } log-level 的有效值包括: debug, info, warn, error, fatal 监控 Prometheus https://docs.docker.com/engine/admin/prometheus/#configure-docker 1 2 3 4 { "metrics-addr" : "127.0.0.1:9323", "experimental" : true } 保持容器在线 https://docs.docker.com/engine/admin/live-restore/#enable-the-live-restore-option 当……

阅读全文

关于 nginx uri 的截取

关于 uri 的截取 location 中的 root 和 alias root 指令只是将搜索的根设置为 root 设定的目录,即不会截断 uri,而是使用原始 uri 跳转该目录下查找文件 alias 指令则会截断匹配的 uri,然后使用 alias 设定的路径加上剩余的 uri 作为子路径进行查找 示例 1: root #------------目录结构---------- /www/x1/index.html /www/x2/index.html #--------……

阅读全文

TCP keepalive 探活机制

TCP keepalive 探活机制 Content here 参考资料 tcp keepalive howto tcp 协议 syn 攻击 为什么基于TCP的应用需要心跳包……

阅读全文

使用 Dockerfile 构建镜像注意事项

面试问 Dockerfile 的优化, 千万不要只会说减少层数 在面试的时候, 我通常都会问「如果优化 Dockerfile」? 面试的朋友大部分都会说 使用更小的基础镜像, 比如 alpine. 减少镜像层数, 使用 && 符号将命令链接起来。 好一点的面试者 我会给基础镜像打上 安全补丁。 但这些都没说到点上。 优化 Dockerfile 的核心是 合理分层。 为什么要……

阅读全文

golang-use-regex-group

golang 使用 regex group 的值 与常用的语言正则不同, golang 使用 $1 表示 regex group。 而类似 sed, python 中常用的是 \1 golang playgroud 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 package main import ( "fmt" "regexp" ) func main() { re := regexp.MustCompile(`([A-Z])`) s := re.ReplaceAllString("UserCreate", ".$1") fmt.Println(s) // .User.Create } func Test_Regexp(t *testing.T) { chars := `('|")` str := `"123'abc'456"` re := regexp.MustCompile(chars) s := re.ReplaceAllString(str, `\$1`) // 这里可以使用 ` 反引号 fmt.Println(s) // \"123\'abc\'456\" } // https://stackoverflow.com/questions/43586091/how-golang-replace-string-by-regex-group python 1 2 3 import re name = re.sub(r'([A-Z])', r'.\1', "UserCreate") print(name) # .User.Create……

阅读全文

福利派送

  • (免费星球)「运维成长路线」

  • 又拍云免费 CDN

最近文章

分类

标签

其它