Docker镜像清理

运行docker system df 命令:

1
2
3
4
5
6
[root@VM_100_4_centos ~]# docker system df 
TYPE                TOTAL                       SIZE                RECLAIMABLE
Images              955                         77.06GB             74.21GB (96%)
Containers          65                          3.28MB              0B (0%)
Local Volumes       0                           0B                  0B
Build Cache         0                           0B                  0B

最后一列RECLAIMABLE字段标明了可回收的磁盘空间大小,此处表示有74.21GB的docker镜像可以收回,而containers、volumes等没有可回收的空间。

……

阅读全文

Hugo使用

零、 下载地址

https://github.com/gohugoio/hugo/releases

可直接运行,如创建一个blog的项目为:

……

阅读全文

Ingress_yaml nginx模板

 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
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  namespace: ${NAMESPACE}
  name: ${APP_NAME}-ingress
  annotations:
    nginx.ingress.kubernetes.io/service-upstream: true
    nginx.ingress.kubernetes.io/ssl-redirect: true
    kubernetes.io/ingress.class: "public-nginx-ingress"
    # 重写规则,相当于location /api/
    nginx.ingress.kubernetes.io/configuration-snippet: |
      rewrite ^/api/(.*)$ /$1 break;
    kubernetes.io/ingress.rule-mix: "true"
    nginx.ingress.kubernetes.io/use-regex: "true"
spec:
  tls:
    - hosts:
      - ${PUBLIC_DOMAIN}
      secretName: ${TLS_SECRET}
  rules:
    - host: ${PUBLIC_DOMAIN}
      http:
        paths:
          - path: ${REQUEST_PATH}
            backend:
              serviceName: ${APP_NAME}
              servicePort: ${RUN_PORT}
    - host: www.tangjihede.fun
      http:
        paths:
          - path: /api/
            backend:
              serviceName: api
              servicePort: 8080
……

阅读全文

nginx ingress 注解大全

 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
# http 跳转https
nginx.ingress.kubernetes.io/ssl-redirect: true

# 腾讯云公网类型
kubernetes.io/ingress.class: "public-nginx-ingress"

# 重写规则,相当于location /api/
nginx.ingress.kubernetes.io/configuration-snippet: |
  rewrite ^/api/(.*)$ /$1 break;

# 重写
annotations:
     nginx.ingress.kubernetes.io/server-snippet: |
         rewrite ^/v4/(.*)/card/query http://foo.bar.com/v5/#!/card/query permanent;
     nginx.ingress.kubernetes.io/configuration-snippet: |
         rewrite ^/v6/(.*)/card/query http://foo.bar.com/v7/#!/card/query permanent;

# 支持websocket协议
nginx.ingress.kubernetes.io/server-snippets: |
      proxy_set_header Upgrade $http_upgrade;
      proxy_http_version 1.1;
      proxy_set_header X-Forwarded-Host $http_host;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header X-Forwarded-For $remote_addr;
      proxy_set_header Host $host;
      proxy_set_header Connection "upgrade";
      proxy_cache_bypass $http_upgrade;

# 腾讯云 https://cloud.tencent.com/document/product/457/45693
kubernetes.io/ingress.rule-mix: "true"

# 支持正则
nginx.ingress.kubernetes.io/use-regex: "true"

# 后端是https协议
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"

# 白名单配置
nginx.ingress.kubernetes.io/whitelist-source-range: "58.246.135.154,58.246.135.155"

#开启ingress access日志
nginx.ingress.kubernetes.io/enable-access-log: true  

# 跨域参考
https://www.tangjihede.fun/post/LoadBalancing/%E8%B7%A8%E5%9F%9F%E9%97%AE%E9%A2%98/

链接:

……

阅读全文

github push error

git push origin master后出错
error: src refspec master does not match any
error: failed to push some refs to 'https://github.com/test.test.git'

原来github的master已经改成main了。。。

……

阅读全文

gitlab send mail err

SendAsDenied; gitlib@example.com not allowed to send as gitlab@git.example.com; STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message

遇到一个gitlab发送邮件的错误,原因是因为gitlab_rails['gitlab_email_from'] = 'gitlab@example.com'该参数没有设置。

……

阅读全文