通过 SSH 隧道实现访问内网机器

适用场景:本地无法直接 ssh 到内网机器,如果内网机器可以访问公网,就可以通过公网的机器打通 ssh 隧道进行访问

假设 IP 信息如下:

  1. 内网机器:172.16.0.1
  2. 公网机器:1.2.3.4
Read more

ETCD 出现高碎片率事件解析

集群频繁触发 etcdDatabaseHighFragmentationRatio 告警, PrometheusRule 内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- alert: etcdDatabaseHighFragmentationRatio
annotations:
description: 'etcd cluster "{{ $labels.job }}": database size in use on instance
{{ $labels.instance }} is {{ $value | humanizePercentage }} of the actual
allocated disk space, please run defragmentation (e.g. etcdctl defrag) to
retrieve the unused fragmented disk space.'
runbook_url: https://etcd.io/docs/v3.5/op-guide/maintenance/#defragmentation
summary: etcd database size in use is less than 50% of the actual allocated
storage.
expr: (last_over_time(etcd_mvcc_db_total_size_in_use_in_bytes{job=~".*etcd.*"}[5m])
/ last_over_time(etcd_mvcc_db_total_size_in_bytes{job=~".*etcd.*"}[5m])) <
0.5 and etcd_mvcc_db_total_size_in_use_in_bytes{job=~".*etcd.*"} > 104857600
for: 10m
labels:
severity: warning
Read more

Cert Manager 使用随记

在 Kubernetes 中常用 Cert Manager 生成并管理自签名证书,常见的 CR 有👇

  1. Issuer: 用于定义如何生成证书
  2. ClusterIssuer: 用于定义如何生成集群级别的证书
  3. Certificate: 用来请求和管理证书的主要资源
  4. CertificateRequest: 是用于手动请求证书的资源
  5. Order: 当使用 ACME 协议时会生成,
  6. Challenge: 是 ACME 协议中的一部分,用于表示 ACME 服务对域名所有权的验证
Read more

调用 NeuVector API 进行镜像扫描

开启 REST API

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Service
metadata:
name: neuvector-service-controller
namespace: cattle-neuvector-system
spec:
ports:
- port: 10443
name: controller
protocol: TCP
type: NodePort
selector:
app: neuvector-controller-pod
EOF
Read more