惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

SecWiki News
SecWiki News
I
InfoQ
The Cloudflare Blog
人人都是产品经理
人人都是产品经理
博客园 - Franky
T
Tailwind CSS Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
量子位
博客园_首页
罗磊的独立博客
V
V2EX
李成银的技术随笔
大猫的无限游戏
大猫的无限游戏
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
True Tiger Recordings
Vercel News
Vercel News
Cyberwarzone
Cyberwarzone
Cisco Talos Blog
Cisco Talos Blog
F
Fox-IT International blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
M
Microsoft Research Blog - Microsoft Research
Know Your Adversary
Know Your Adversary
爱范儿
爱范儿
The Register - Security
The Register - Security
G
Google Developers Blog
The Hacker News
The Hacker News
Malwarebytes
Malwarebytes
S
Securelist
博客园 - 三生石上(FineUI控件)
Jina AI
Jina AI
T
Threat Research - Cisco Blogs
T
The Exploit Database - CXSecurity.com
S
SegmentFault 最新的问题
博客园 - 叶小钗
F
Fortinet All Blogs
Apple Machine Learning Research
Apple Machine Learning Research
宝玉的分享
宝玉的分享
博客园 - 聂微东
T
Threatpost
博客园 - 【当耐特】
D
Docker
P
Privacy & Cybersecurity Law Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
G
GRAHAM CLULEY
V
Visual Studio Blog
C
Cisco Blogs
IT之家
IT之家
S
Security Archives - TechRepublic
Latest news
Latest news
阮一峰的网络日志
阮一峰的网络日志

hwchiu learning note Blog

Kubernetes 怎麼計算 imageFS | hwchiu learning note Nginx Proxy_Pass 不會重新查詢 DNS | hwchiu learning note Multus 下如何透過 network policy 設定 | hwchiu learning note Linux Bridge MTU | hwchiu learning note Kubevirt 初體驗 | hwchiu learning note [MacOS ]隨手筆記 Sed 與 Rename 的使用 | hwchiu learning note Docusaurus 使用 blog mode 後連結一直反白的問題 | hwchiu learning note gcloud 切換帳號 | hwchiu learning note Helm Chart 中如何根據條件來動態安裝 Template 內的物件 | hwchiu learning note GCS 操作上注意事項 | hwchiu learning note istio 操作記錄 | hwchiu learning note terraform | hwchiu learning note Kubernetes GKE 維運上小筆記 | hwchiu learning note Git 修改 author/committer | hwchiu learning note GCP NAT 相關筆記 | hwchiu learning note gcloud ssh 到 GCP VM | hwchiu learning note CloudSQL 收費注意事項 | hwchiu learning note Loki 安裝上的參數調整以及 Ring 的問題除錯 | hwchiu learning note kustomize + helm | hwchiu learning note 觀測 K8s 內 OOM 事件 | hwchiu learning note GKE 上的 RBAC 筆記 | hwchiu learning note 本地產生 jwt token | hwchiu learning note ArgoCD 安裝筆記 | hwchiu learning note CircleCI Context 的使用 | hwchiu learning note 透過 GCP IAP Gateway 來保護 GKE 內的網站 | hwchiu learning note 閱讀筆記: 「SRE 的工作介绍」 | hwchiu learning note 閱讀筆記: 「DevOps is a failure」 | hwchiu learning note 閱讀筆記: 「面試人生 - 設計一個簡易的分散式 Job Scheduler」 | hwchiu learning note 閱讀筆記: 「Cloudflare 06/21 災後報告」 | hwchiu learning note 閱讀筆記: 「啟動 container 直接 kernel panic 的 bug」 | hwchiu learning note 閱讀筆記: 「分散式系統上的常見網路謬誤」 | hwchiu learning note 閱讀筆記: 「為什麼有些工程師不相信 Best Practices 」 | hwchiu learning note 閱讀筆記: 「使用 StressChaos 的經驗來學習 Pod Memory 使用情況」 | hwchiu learning note 閱讀筆記: 「/proc/meminfo 與 free 指令的內容比較」 | hwchiu learning note 閱讀筆記: 「goss, 一個簡易且迅速的 server 驗證工具」 | hwchiu learning note 閱讀筆記: 「如何寫出有意義的討論訊息 」 | hwchiu learning note 閱讀筆記: 「如何提供專業 Code Review 意見」 | hwchiu learning note 閱讀筆記: 「Mizu, 一套用來檢視 Kubernetes Traffic 的視覺化工具」 | hwchiu learning note 閱讀筆記: 「Tetragon, 基於 eBPF 的 Kubernetes 資安管理工具」 | hwchiu learning note 閱讀筆記: 「Datree, Kubernetes Configuration 檢查工具」 | hwchiu learning note 閱讀筆記: 「基於 eBPF 的 ServiceMesh」 | hwchiu learning note 閱讀筆記: 「提升 DevOps 技術的免費書籍」 | hwchiu learning note 閱讀筆記: 「新手閱讀,我踩過的 Terraform 各種雷」 | hwchiu learning note 閱讀筆記: 「容器的除錯之路,遇到 Permission Denied 該怎麼辦」 | hwchiu learning note 閱讀筆記: 「成為軟體架構師的閱讀之路」 | hwchiu learning note 閱讀筆記: 「使用 serverless 5年後的心酸經驗談」 | hwchiu learning note 閱讀筆記: 「istio 下因為YAML 與 Go template 結合產生的 CVE」 | hwchiu learning note 閱讀筆記: 「三座獨立 k8s cluster 還是一個跨三個地區的 k8s cluster ?」 | hwchiu learning note 閱讀筆記: 「DevOps 的 2022 學習之路」 | hwchiu learning note 閱讀筆記: 「強化 Kubernetes 叢集的必備工具」 | hwchiu learning note 閱讀筆記: 「你真的有正確使用 SSH 嗎?」 | hwchiu learning note 閱讀筆記: 「透過 Kubernetes Event-Driver Autoscaler(KEDA) 來根據各種指標動態擴充容器」 | hwchiu learning note 閱讀筆記: 「升級 Kubernetes 1.22 的注意事項」 | hwchiu learning note 閱讀筆記: 「kubectl delete 的行為跟 docker delete 完全不同」 | hwchiu learning note 閱讀筆記: 「Dockerfile 中透過 COPY --chomd 比透過 RUN chomd 可以省下更多空間」 | hwchiu learning note 閱讀筆記: 「軟體工程師你真的工作的很開心嗎??」 | hwchiu learning note 閱讀筆記: 「如何於 Docker 環境中運行 rootless 模式」 | hwchiu learning note 閱讀筆記: 「一個用來管理 Kubernetes 開源工具的開源工具」 | hwchiu learning note 閱讀筆記: 「為什麼 3A 大作的遊戲室都不愛喜歡使用 STL」 | hwchiu learning note 閱讀筆記: 「Terraform 生態下的五個相關輔助工具」 | hwchiu learning note 閱讀筆記: 「Facebook 內的文化特別之處」 | hwchiu learning note 閱讀筆記: 「Package Maintainers 應該要具備的資安概念」 | hwchiu learning note 閱讀筆記: 「如何判別到底要不要使用 Service Mesh」 | hwchiu learning note 閱讀筆記: 「透過 Helm 與 Terraform 來自動 Re-new Cloudflare origin CA」 | hwchiu learning note 閱讀筆記: 「20年工程師生涯教會我的 20 件事情」 | hwchiu learning note 閱讀筆記: 「Kubernetes 紀錄片 」 | hwchiu learning note 閱讀筆記: 「Golang 原始碼的的版本控制歷史」 | hwchiu learning note 閱讀筆記: 「大家總是喜歡誇大自己的工作時數」 | hwchiu learning note 閱讀筆記: 「ClickHouse 與 Elasticsearch 的比較」 | hwchiu learning note 閱讀筆記: 「Paypal 如何調整 Kubernetes 讓其規模達到四千節點,20萬個 Pod」 | hwchiu learning note 閱讀筆記: 「macOS 的 fsync 實作其實跟大家想像的完全不同 」 | hwchiu learning note 閱讀筆記: 「 取代 Docker Desktop 的高效率開發環境」 | hwchiu learning note 閱讀筆記: 「 Kubernetes 四種不同開發環境的比較」 | hwchiu learning note 閱讀筆記: 「 談談遷移應用程式到 Kubernetes 內的失敗經驗談」 | hwchiu learning note 閱讀筆記: 「GitHub 上常常看到的奇妙 commit 到底是什麼?」 | hwchiu learning note 閱讀筆記: 「透過一點小技巧讓你的 Makefile 有一個更好的 Help說明」 | hwchiu learning note 閱讀筆記: 「視覺化系統內 iptables 規則」 | hwchiu learning note hwchiu learning note 閱讀筆記: 「如何使用 jq 讓你的 kubectl更為強大」 | hwchiu learning note 閱讀筆記: 「PwnKit, 長達 12 年可以讓一般使用者輕鬆變成 Root 的 CVE」 閱讀筆記: 「Linux 5.17 將使用 BLAKE2s 來替代 SAH1 來達到更安全更快速的隨機亂數產生器」 | hwchiu learning note 閱讀筆記: 「Kubernetes 內透過 DNS-01 處理 wildcard TLS 的兩三事」 | hwchiu learning note 閱讀筆記: 「透過 Crossplane 與 ArgoCD 來達成應用程式與基礎建設的 GitOps 部署方式」 | hwchiu learning note 閱讀筆記: 「The pains of GitOps 1.0」 | hwchiu learning note 閱讀筆記: 「NPM 的 colors modules 打亂一堆人...」 | hwchiu learning note 閱讀筆記: 「2021年回顧,因為 DB 的效能的爭論所以我女友跟我分手了....」 | hwchiu learning note 閱讀筆記: 「使用 OpenKruise v1.0 提供更進階的 workload 部署與升級」 | hwchiu learning note 閱讀筆記: 「透過 Kubefarm 來自動化幫實體機器打造基於 Kubernetes in Kubernetes 的 Kubernetes 環境」 | hwchiu learning note 閱讀筆記: 「Meta 如何打造一個供多團隊使用的 SLI/SLO 設定與觀測平台」 | hwchiu learning note 閱讀筆記: 「多年工作經驗總是搞砸電話面試, why ?」 | hwchiu learning note 系統設計文,探討交友app背後的設計理念 | hwchiu learning note 2021-年度回顧 | hwchiu learning note [Cloud Design Pattern] - Ambassador 模式 | hwchiu learning note 是時候停止使用 python 3.6 | hwchiu learning note 工作20 餘年的軟體架構經驗談 Dockerfile 內 Shell/Exec 的用法差異 | hwchiu learning note Bash 下要如何處理 Signal | hwchiu learning note Infrastructure 各種踩雷經驗 | hwchiu learning note 建置 Container Image 中的 Anti-Patterns | hwchiu learning note 又一個 0-day... | hwchiu learning note
k8s 內安裝 redis-cluster | hwchiu learning note
HungWei Chiu · 2023-09-11 · via hwchiu learning note Blog

如何投過 Bitnami 的 Helm Chart 來安裝 Redis-Cluster

採用 Kustomize + Helm 的方式 (ArgoCD)

$ cat kustomization.yaml
helmCharts:
- name: redis-cluster
includeCRDs: false
valuesFile: redis.yaml
releaseName: redis-cluster
namespace: production
version: 9.0.5
repo: https://charts.bitnami.com/bitnami

$ cat redis.yaml

global:
storageClass: standard-rwo
existingSecret: redis-cluster
existingSecretPasswordKey: password
redis:
resources:
limits:
cpu: 2
memory: 2Gi
requests:
cpu: 0.1
memory: 0.5Gi
podAnnotations:
'xxxxx': 'yyyyy'

這種部署方式就會啟動密碼驗證機制,而密碼則來自於同 namespace 的 secret 物件 redis-cluster 內的 key password.

如果想要無密碼驗證,可以使用下列方式

usePassword: false

'''note 如果已經先行有密碼驗證,則修改此欄位對於運行中的 Redis Cluster 不會有任何效果,這部分需要更多額外操作來完成,砍掉 PVC 重新部署是一個簡單暴力的方式。 '''

由於此架構會部署 Redis-cluster,預設情況下會部署三組(master+worker)的 statefulset,並且給兩組 servicee

redis-cluster                       ClusterIP      10.2.5.248    <none>        6379/TCP                                                                                          213d
redis-cluster-headless ClusterIP None <none> 6379/TCP,16379/TCP 213d

另外要注意的是,redis-cluster 並不適用 kubectl port-forward 的方式連接,因為 redis-cluster 的溝通過程會回傳其他 Pod 的 IP 給你,而每個 Pod 的 IP 都用相同的 Port,因此除非你有辦法於本地產生一些虛擬網卡並且搭配多組 kubectl port-forawrd 幫每個 Pod 都打通,否則存取上會出問題。

舉例來說

$ kubectl port-forward --address 0.0.0.0 pod/redis-cluster-0 6379:6379
Forwarding from 0.0.0.0:6379 -> 6379
$ redis-benchmark -n 1 --cluster
Cluster has 3 master nodes:

Master 0: 1020525d25c7ad16e786a98e1eb7419d609b8847 10.4.0.119:6379
Could not connect to Redis at 10.4.0.119:6379: Connection refused

可以看到透過 port-forward 打進去後,接下來的連線就會轉到其他的 pod 然後就會失敗,因此這種情況要簡單使用還是部署一個包含 redis 指令的 Pod 到同樣的 namespace 並且用 kubectl exec 進去操作會比較順

$ kubectl run --image=hwchiu/netutils test
$ kubectl exec -it test -- bash
root@test:/# redis-benchmark -h redis-cluster -q -c 20 -n 30000
PING_INLINE: 44977.51 requests per second
PING_BULK: 48154.09 requests per second
SET: 45317.22 requests per second
GET: 47169.81 requests per second
INCR: 50251.26 requests per second
LPUSH: 48465.27 requests per second
LPOP: 41265.48 requests per second
SADD: 37878.79 requests per second
SPOP: 49833.89 requests per second
LPUSH (needed to benchmark LRANGE): 51724.14 requests per second
LRANGE_100 (first 100 elements): 43041.61 requests per second
LRANGE_300 (first 300 elements): 35842.29 requests per second
LRANGE_500 (first 450 elements): 36014.41 requests per second
LRANGE_600 (first 600 elements): 33259.42 requests per second
MSET (10 keys): 42796.01 requests per second