Skip to content

Commit

Permalink
更新部分内容
Browse files Browse the repository at this point in the history
  • Loading branch information
weiliang-ms committed Apr 22, 2024
1 parent f1d1ed8 commit 6a03009
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 0 deletions.
6 changes: 6 additions & 0 deletions 2.容器/k8s/helm/helm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## 下载chart至本地

```shell
helm repo add bitnami https://charts.bitnami.com/bitnami
helm pull bitnami/redis --version=17.9.4 --untar
```
36 changes: 36 additions & 0 deletions 2.容器/k8s/troubleshoot/rook.md
Original file line number Diff line number Diff line change
@@ -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
```
恢复使用
56 changes: 56 additions & 0 deletions 2.容器/kubesphere/clientip.md
Original file line number Diff line number Diff line change
@@ -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





22 changes: 22 additions & 0 deletions 3.集成部署/nginx/配置pdf预览.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 6a03009

Please sign in to comment.