安裝 Istio 時注意如下幾點:html
在容器服務集羣管理頁面能夠直接在目標集羣上部署 Istiogit
選擇好目標集羣使用一鍵部署功能直接安裝便可, 安裝文檔github
設置數據導入方式docker
選擇 Docker標準輸出api
{ "inputs": [ { "detail": { "IncludeEnv": { "K_SERVICE": "helloworld-go" }, "IncludeLabel": {}, "ExcludeLabel": {} }, "type": "service_docker_stdout" } ], "processors": [ { "detail": { "KeepSource": false, "NoMatchError": true, "Keys": [ "time", "level", "msg" ], "NoKeyError": true, "Regex": "(\\d+-\\d+-\\d+ \\d+:\\d+:\\d+)\\s+(\\w+)\\s+(*)", "SourceKey": "content" }, "type": "processor_regex" } ] }
分別爲相應的鍵值 time、level 和 msg 設置數據類型瀏覽器
到容器服務控制檯頁面,打開集羣詳情頁。複製 KubeConfig 內容保存到本地 ~/.kube/config 文件併發
安裝app
cd helloworld-go kubectl apply -f sample/service.yaml
多訪問幾回 helloworld-go 生成一些訪問日誌wordpress
./sample/run-test.sh
生成一些訪問日誌之後點擊查詢,便可查看相應的日誌工具
日誌服務控制檯: https://sls.console.aliyun.com
日誌服務有豐富的查詢條件,好比查詢 ERROR 日誌
使用下查詢語句進行搜索,這條語句使用了 SELECT ,能夠進行更高級別的操做。
level:ERROR | SELECT COUNT(*) as total
搜索ERROR 日誌,時間跨度選擇一分鐘。
點擊另存爲告警
觸發條件的變量就是 左側表格中的列名稱
以下設置的含義是,1分鐘檢索一次 ERROR 日誌的數量若是大於等於4 就告警。
能夠設置多種告警通知方式,而且告警 body 還能夠使用系統變量。獲取告警的上下文信息。
打開郵件能夠看到告警通知
選擇相應的 Region,點擊應用列表查看應用列表
調用鏈查詢頁面
下載源文件: https://kstarter.oss-cn-beijing.aliyuncs.com/knload-result.html ,直接用瀏覽器打開便可查看
壓測的併發數陡增致使服務響應時間抖動,但隨着 Pod 數量的自動擴容 RT 很快就恢復到了正常水位。
工程
部署 WordPress
## ENV 換成具體的值 env: - name: WORDPRESS_DB_HOST value: {db_host:3306} - name: WORDPRESS_DB_NAME value: {db_name} - name: WORDPRESS_DB_USER value: {db_user} - name: WORDPRESS_DB_PASSWORD value: {db_password}
## 部署 WordPress # kubectl apply -f /Users/qiulin.nql/works/github/knative-sample/secret/wordpress-service.yaml kubectl apply -f sample/service.yaml ```
添加 Egress
kubectl apply -f sample/egress.yaml
訪問 WordPress 服務
./hack/run-wp-test.sh
日誌收集
{ "inputs": [ { "detail": { "IncludeEnv": { "K_SERVICE": "wordpress" }, "IncludeLabel": {}, "ExcludeLabel": {} }, "type": "service_docker_stdout" } ], "processors": [ { "detail": { "KeepSource": false, "NoMatchError": true, "Keys": [ "ip", "time", "req", "code" ], "NoKeyError": true, "Regex": "(\\d+.\\d+.\\d+.\\d+)\\s+-\\s+(\\d+/\\w+/\\d+:\\d+:\\d+:\\d+\\s\\+\\d+)\\s\"(.*)\"\\s(\\d+)", "SourceKey": "content" }, "type": "processor_regex" } ] }
hey -z 30s -c 50 "http://wordpress.default.example.com/" && kubectl get pods
本文爲雲棲社區原創內容,未經容許不得轉載。