YuChia

@YuChia

這邊是我自己的簡短筆記,有些內容可能不完整或是有疏漏,歡迎大家指正與提供意見。

Joined on Jan 8, 2021

  • graph LR; Service1("AspNetCore Server</br>+</br>OpenTelemetry auto instrumentations") --log/metrics/tracing--> OpenTelemetryCollector; Service2("AspNetCore Server</br>+</br>OpenTelemetry auto instrumentations") --log/metrics/tracing--> OpenTelemetryCollector; Service3("AspNetCore Server</br>+</br>OpenTelemetry auto instrumentations") --log/metrics/tracing--> OpenTelemetryCollector; Service2 --> Service3 OpenTelemetryCollector(<img src='https://cncf-branding.netlify.app/img/projects/opentelemetry/icon/color/opentelemetry-icon-color.svg' width='30'>OpenTelemetry Collector) --> Tempo; OpenTelemetryCollector --> Loki; OpenTelemetryCollector --> Prometheus; Tempo(<img src='https://grafana.com/static/img/menu/grafana-tempo.svg' width='25'>Tempo) --> Grafana(<img src='https://grafana.com/static/img/menu/grafana2.svg' width='25'>Grafana); Loki(<img src='https://grafana.com/static/img/menu/loki.svg' width='25'>Loki) --> Grafana;
     Like  Bookmark
  • windows winget install # dotnet sdk winget install Microsoft.DotNet.SDK.9 winget install Microsoft.DotNet.SDK.8 winget install Microsoft.DotNet.SDK.7 winget install Microsoft.DotNet.SDK.6 # go sdk winget install GoLang.Go
     Like  Bookmark
  • 慣用字型安裝方式與相關資料 basic font firacode current version: 6.2 github release zip use choco
     Like  Bookmark
  • :::info k3d 的命令說明可以參考 https://hackmd.io/@YuChia/create-k3s-cluster-use-k3d 以下內容都是在 windows + docker 的環境下完成的 windows 內可以利用 C:\Windows\System32\drivers\etc\hosts 這個檔案設定 domain ::: init k3d & install istio k3d cluster create service-lab --servers 1 --agents 2 --port 8443:443@loadbalancer --port 8080:80@loadbalancer --api-port 6443 --k3s-arg '--disable=traefik@server:0'
     Like  Bookmark
  • 這邊是我自己在使用的 File Template & Code Style,給有需要的人參考,相關說明後續會持續補上。 File Template MS Test $HEADER$namespace $NAMESPACE$ { [Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute] public class $CLASS$Tests { [Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute]
     Like  Bookmark
  • oh-my-posh 官方安裝文件 new version 新版本可以直接用 winget 進行安裝 winget install JanDeDobbeleer.OhMyPosh -s winget old version oh-my-posh --init --shell pwsh --config C:\Users\g6994\Documents\WindowsPowerShell\Modules\oh-my-posh\themes\night-owl.omp.json | Invoke-Expression install
     Like  Bookmark
  • :::info 使用的 OS 為 Ubuntu 20.04 LTS ::: RKE2 中國官方文件 Server (Master) Node 依據 RKE2 官方 HA 文件 說明,含有 master 性質的主機應為奇數,即 1,3,5... 等數量。 RKE2 預設安裝的 Node 為 master + worker (即此 Node 可作為 worker 部署服務),若要設定純 master 需要另外在設定檔中加入參數控制。
     Like 1 Bookmark
  • dotnet 7 (含) 以下的 expose 設定 FROM mcr.microsoft.com/dotnet/aspnet:7.0-bookworm-slim AS base WORKDIR /app EXPOSE 80 EXPOSE 443 dotnet 8 以後的 expose 設定 方案一:配合官方異動,改成 expose 8080,並調整 docker run 與 k8s 中的網路設定 dockerfileFROM mcr.microsoft.com/dotnet/aspnet:8.0-bookworm-slim AS base WORKDIR /app EXPOSE 8080
     Like  Bookmark
  • 如果不想在 windows 內安裝 docker-desktop 這個容器工具的話,可以考慮使用 WSL2 的 linux 來安裝、使用容器,以下是相關安裝命令。 :::info 除非特別切換到 root 進行操作,不然用預設使用者的話,docker / nerdctl 都需要加上 sudo 來操作。 docker / nerdctl 都有提供 rootless 的安裝方式,我尚未進行相關的安裝測試...... 有安裝的話再更新筆記上來。 ::: wsl install 其他資訊請參閱微軟官方文件
     Like 1 Bookmark
  • prometheus & prometheus Adapter ArgoCD Application Setting Gragana 使用 istio 1.14.1 安裝包內附版本 (8.3.1) 好用的 Grafana 面板 叢集內的資源使用率-Cluster Monitoring for Kubernetes 調整參數定義,修正成我安裝的新版普羅米修斯參數,並參考下方 6336 (暫存第一條) 的儀錶板的版本 = https://hackmd.io/IGsCUmALR1mFy2X8doKxsQ 各 Node 狀態-Kubernetes Nodes 倚賴 Node Exporter 完整個 Node 資料輸出-Node Exporter Full
     Like  Bookmark
  • :::info authOptions 這個物件是我另外建立的,從 appsettings.json 中取資料的 model OAuth Server = IdentityServer4 .net core 3.1 / .net 5 / .net 6 / .net 7 或以上皆通用 ::: builder.Services.AddAuthentication(options => {
     Like  Bookmark
  • dotnet dockerfile 撰寫筆記 tls1.0 support bullseye-slim (debain 11) :::info dotnet/aspnet:{version} 版本的 dockerfile 調整方式與此相同,因為 os 都是 debain ::: FROM mcr.microsoft.com/dotnet/aspnet:$dotnetVersion-bullseye-slim AS base RUN sed -i 's/DEFAULT@SECLEVEL=2/DEFAULT@SECLEVEL=1/g' /etc/ssl/openssl.cnf
     Like  Bookmark
  • 起因 公司內部的 IdentityServer 所輸出的人員名稱是放在 token 中的 name 這個欄位,但是從 dotnet 7 開始,Jwt 的解析就有一些更新,這邊紀錄一些資料。 自行解析 雖然 .net 在 httpContext 中可以取得使用者資訊,但是僅限能被 token handler 解析配對資料的部分才會被設定到 httpContext.User.Identity 之中,其他資料可以用以下方式取得 httpContext.User.ClaimsFirstOrDefault(x => x.Type == "name")?.Value; 但是這是自己去抓 token 內的欄位,我個人比較偏好利用 .net 原生的處理模式取得人員資料,也就是利用 httpContext.User.Identity 來去取得相關資訊,因此有了後續章節的設定。 幫 Jwt Token Handler 加入配對資料 ( .net 7 )
     Like 1 Bookmark
  • 緣由: 主機安裝好 k8s 叢集 (使用 rke2) 後,部署 .net 6 web api 服務時發生以下問題 Unhandled exception. System.IO.IOException: The configured user limit (128) on the number of inotify instances has been reached, or the per-process limit on the number of open file descriptors has been reached. at System.IO.FileSystemWatcher.StartRaisingEvents() at System.IO.FileSystemWatcher.StartRaisingEventsIfNotDisposed() at System.IO.FileSystemWatcher.set_EnableRaisingEvents(Boolean value) at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.TryEnableFileSystemWatcher() at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.CreateFileChangeToken(String filter) at Microsoft.Extensions.FileProviders.PhysicalFileProvider.Watch(String filter)
     Like  Bookmark
  • apt-get proxy 問題 單次繞過 Proxy 如果使用 apt-get 安裝、更新套件出現 Proxy 問題時,可以使用 -o Acquire::http::proxy=false 參數來單次性的繞過 Proxy ref: apt-get 暫時忽略 proxy sudo apt-get -o Acquire::http::proxy=false update sudo apt-get -o Acquire::http::proxy=false install <package-name> 全域控制繞開 Proxy 若要完全避開 Proxy 的話,可以到 /etc/apt/apt.conf.d/ 這個目錄找 **proxy.conf 的檔案,並修改內容
     Like  Bookmark
  • :::info k3d 的命令說明可以參考 https://hackmd.io/@YuChia/create-k3s-cluster-use-k3d 筆記內關於 host 相關的名稱請自行依據實際狀況進行調整!! 此筆記內使用的 istio ingress 為預設安裝的 ingress,如果有自訂 ingress gateway 的話請自行調整 istio gateway 設定 以下內容都是在 windows + docker 的環境下完成的 windows 內可以利用 C:\Windows\System32\drivers\etc\hosts 這個檔案設定 domain ::: init k3d & install istio
     Like  Bookmark
  • :::danger k3d 是社群開發的 k3s in docker 的快速建立叢集的工具,方便在 docker 內使用 k3s 建立 kubernetes 叢集 由於是純社群開發的工具,且因為是跑在 docker 內部,我會建議用在 kubernetes 上的服務開發用途,而非正式服務部署 ::: k3s官網 k3d 官網 在k3d上快速安装Istio,助你在本地灵活使用K8S! K3d and Istio (Service Mesh - Governing the data plane)
     Like 1 Bookmark
  • :::warning 這份筆記後續沒有維護,yaml 應該有錯誤,參考此份文件作業之前請注意此問題 ::: https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-install-helm.html https://github.com/elastic/cloud-on-k8s (這邊可以找參考) :::warning ECK Operator 預設安裝後取得的是基本授權 (免費),但是內部 ECK 相關的 Helm 安裝設定全部都是企業版限定 (github issue) 未來是否可以使用 value yaml 控制還不得而知,所以現階段需要在安裝好 eck operator 之後自行撰寫各服務的安裝 yaml 檔案來進行安裝
     Like  Bookmark
  • ELK MEMO Elastic APM Open Telemetry Native Support Elastic APM Open Telemetry Resource Attributes Elastic Collect Metrics Elastic Trace Resource Keys Open-Telmetry Semantic-Conventions Docs Open-Telemetry Resource (index page) Open-Telemetry Resource Cloud Open-Telemetry Resource k8s
     Like  Bookmark
  • :::info 筆記內關於 host 相關的名稱請自行依據實際狀況進行調整!! 此筆記內使用的 istio ingress 為預設安裝的 ingress,如果有自訂 ingress gateway 的話請自行調整 istio gateway 設定 ::: use cert-manager Certificate cert-manager Certificate :::info 把這資料從自己的電腦整理出來給公司同事使用之後發現有問題,應該是不需要這個
     Like  Bookmark