diff --git "a/2.\345\256\271\345\231\250/k8s/helm/helm.md" "b/2.\345\256\271\345\231\250/k8s/helm/helm.md" new file mode 100644 index 00000000..0955906b --- /dev/null +++ "b/2.\345\256\271\345\231\250/k8s/helm/helm.md" @@ -0,0 +1,6 @@ +## 下载chart至本地 + +```shell +helm repo add bitnami https://charts.bitnami.com/bitnami +helm pull bitnami/redis --version=17.9.4 --untar +``` \ No newline at end of file diff --git "a/2.\345\256\271\345\231\250/k8s/troubleshoot/rook.md" "b/2.\345\256\271\345\231\250/k8s/troubleshoot/rook.md" new file mode 100644 index 00000000..b09da6d9 --- /dev/null +++ "b/2.\345\256\271\345\231\250/k8s/troubleshoot/rook.md" @@ -0,0 +1,36 @@ +## 挂载Pvc失败提示已被占用 + +错误描述: + +```shell +image replicapool/csi-vol-1d14612c-6e37-11ee-a86b-5a729ca4e4e3 is still being used +``` + +**解决流程:** + +查询rbd对象管理端Pod + +```shell +for pod in `kubectl -n rook-ceph get pods|grep rbdplugin|grep -v provisioner|awk '{print $1}'`; do echo $pod; kubectl exec -it -n rook-ceph $pod -c csi-rbdplugin -- rbd device list; done|grep csi-vol-1d14612c-6e37-11ee-a86b-5a729ca4e4e3 -C 3 +``` + +连接rbd csi-rbdplugin + +```shell +kubectl exec -it csi-rbdplugin-8w8wx -n rook-ceph -c csi-rbdplugin -- bash +``` + +确认 + +```shell +rbd device list|grep csi-vol-1d14612c-6e37-11ee-a86b-5a729ca4e4e3 +0 replicapool csi-vol-1d14612c-6e37-11ee-a86b-5a729ca4e4e3 - /dev/rbd0 +``` + +强制卸载映射 + +```shell +rbd unmap -o force /dev/rbd0 +``` + +恢复使用 \ No newline at end of file diff --git "a/2.\345\256\271\345\231\250/kubesphere/clientip.md" "b/2.\345\256\271\345\231\250/kubesphere/clientip.md" new file mode 100644 index 00000000..04a57b60 --- /dev/null +++ "b/2.\345\256\271\345\231\250/kubesphere/clientip.md" @@ -0,0 +1,56 @@ +## +获取 client ip + +## 环境说明 + +all in one + +kubesphere 版本:v3.4.1 + +kubernetes 版本: v1.23.17 + +client_ip: 192.168.1.2 + +cni: cilium + +cilium_host ip 10.233.64.175 + +server ip 10.8.0.2 +gateway ip 10.8.0.2 + + +## 程序代码片段 + +非常简单的一个 RESTFUL 接口,返回调用者 Request 头相关值信息 + +```golang +package main + +import ( + "github.com/gin-gonic/gin" +) + +func main() { + r := gin.Default() + r.GET("/ppp", func(c *gin.Context) { + c.JSON(200, gin.H{ + "remote_addr": c.RemoteIP(), + "client_ip": c.ClientIP(), + "X-Forwarded-For": c.GetHeader("X-Forwarded-For"), + }) + }) + r.Run() // listen and serve on 0.0.0.0:8080 +} + +``` + +### 调用链路 + +browser -> ks gateway -> svc -> pod + +## 默认方式访问: 获取的客户端地址为node节点ip + + + + + diff --git "a/3.\351\233\206\346\210\220\351\203\250\347\275\262/nginx/\351\205\215\347\275\256pdf\351\242\204\350\247\210.md" "b/3.\351\233\206\346\210\220\351\203\250\347\275\262/nginx/\351\205\215\347\275\256pdf\351\242\204\350\247\210.md" new file mode 100644 index 00000000..67c1e06c --- /dev/null +++ "b/3.\351\233\206\346\210\220\351\203\250\347\275\262/nginx/\351\205\215\347\275\256pdf\351\242\204\350\247\210.md" @@ -0,0 +1,22 @@ + +`default_type application/pdf;` + +```shell +location = /pdf_carpet { + alias /var/www/html/pdf_carpet/file.pdf; + default_type application/pdf; + add_header Content-Disposition 'inline'; +} +``` + +如果访问 PDF 文件的 URI 以斜杠结尾(或者它是一个特殊情况的根 URI),则上述配置将不起作用,因为 nginx 会将索引文件名附加到这样的 URI(使location = /path/ { ... }不匹配$uri内部 nginx 变量)。对于这种情况,可以使用另一种技术: + +```shell +location = / { + root /var/www/html/pdf_carpet; + rewrite ^ /file.pdf break; + add_header Content-Disposition 'inline'; +} +``` + +源:https://devpress.csdn.net/cloud/630546977e6682346619dd7e.html \ No newline at end of file