F5 Labs - Index
ようこそ!
座学資料
このラボはNGINX Ingress ControllerやNGINX Service Meshと各種監視ツールの設定方法などご確認いただけます。
参考資料
環境
実施環境
- 事前にラボ環境へのInviteを行っておりますので、メールをご確認ください
- 利用するコマンド: git , jq , sudo, curl, make, kubectl(kubenetes環境)
- NGINX Trialライセンスの取得、ラボ実施ユーザのHome Directoryへ配置
ラボ環境 (UDF(Unified Demonstration Framework)) コンポーネントへの接続
HELMについて
Helm とは - Kubernetes用パッケージマネージャ - Helmは、Kubernetes 用に構築されたソフトウェアを検索、共有、使用するための方法です。 - Kubernetes環境にソフトウェアを簡単にデプロイできます
このラボでは、NGINX Ingress Controller、NGINX Service Mesh、各種監視コンポーネントをHelmを使ってデプロイします
デプロイする構成について
このラボでサンプルアプリケーションをデプロイした結果の構成は以下の様になります。
- Namespace
nginx-ingress
にNIC、nginx-mesh
にNSMのコンポーネント、monitor
に監視コンポーネントをデプロイします - NSMのSidecarを挿入する対象のNamespaceとして
prod
、staging
、legacy
をデプロイします - NSMの管理コンポーネントに接続するために
nic2
というNICをデプロイします - NSMのSidecarを挿入するアプリケーションに接続するために
nic1
というNICをデプロイします - GrafanaのDatasouceとして
Prometheus
、Loki
、Jaeger
を指定し、ステータスを確認できるようにします
NGINX NIC / NSM のセットアップ
1. 事前セットアップ、HELMのインストール
必要なファイルを取得します。
cd ~/
git clone https://github.com/BeF5/f5j-nsm-lab.git
cd ~/f5j-nsm-lab/prep
NSMテスト用のNamespaceを作成します
# cd ~/f5j-nsm-lab/prep
kubectl apply -f nsm-demo-ns.yaml
1 2 3 | namespace/prod created namespace/staging created namespace/legacy created |
こちらのラボでは、HELMを使って環境をセットアップします。 HELMをinstallします。
curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
sudo apt-get update
sudo apt-get install helm
正しくHELMがインストールされたことを確認します
helm version
1 | version.BuildInfo{Version:"v3.10.2", GitCommit:"50f003e5ee8704ec937a756c646870227d7c8b58", GitTreeState:"clean", GoVersion:"go1.18.8"} |
必要なファイルを取得します
cd ~/
git clone https://github.com/BeF5/f5j-nginx-observability-lab.git --branch v1.1.0
2. NSMのセットアップ
必要なファイルを取得します
cd ~/
git clone https://github.com/nginxinc/nginx-service-mesh --branch v1.6.0
cd ~/nginx-service-mesh
取得した内容が意図したVersionであることを確認します
## cd ~/nginx-service-mesh
git show -s
1 2 3 4 5 6 7 8 | commit bb6d6f4e8443deda81932057d0f97d9ab4f6e23a (HEAD, tag: v1.6.0, origin/main, origin/HEAD) Merge: e0297f0 066bc5d Author: Saylor Berman <s.berman@f5.com> Date: Tue Nov 1 12:06:58 2022 -0600 Merge pull request #82 from nginxinc/release-1.6.0 Helm release - 1.6.0 |
cat ~/f5j-nginx-observability-lab/prep/helm/nsm-values.yaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | # NGINX Service Mesh image registry settings. registry: # Hostname:port (if needed) for registry and path to images. # Affects: nginx-mesh-api, nginx-mesh-cert-reloader, nginx-mesh-init, nginx-mesh-metrics, nginx-mesh-sidecar server: "docker-registry.nginx.com/nsm" # Tag used for pulling images from registry # Affects: nginx-mesh-api, nginx-mesh-cert-reloader, nginx-mesh-init, nginx-mesh-metrics, nginx-mesh-sidecar imageTag: "1.6.0" # Environment to deploy the mesh into. # Valid values: kubernetes, openshift environment: "kubernetes" # Enable UDP traffic proxying (beta). Linux kernel 4.18 or greater is required. enableUDP: false # NGINX log format. # Valid values: default, json nginxLogFormat: "json" # NGINX load balancing method. # Valid values: [least_conn, least_time, least_time last_byte, least_time last_byte inflight, # random, random two, random two least_conn, random two least_time, random two least_time=last_byte, round_robin] nginxLBMethod: "round_robin" # The address of a Prometheus server deployed in your Kubernetes cluster. # Address should be in the format <service-name>.<namespace>:<service-port>. prometheusAddress: "prometheus-server.monitor:80" # Globally disable automatic sidecar injection upon resource creation. # Use either "enabledNamespaces" or a namespace label to enable automatic injection. disableAutoInjection: true # Enable automatic sidecar injection for specific namespaces. # Must be used with "disableAutoInjection". enabledNamespaces: [ staging , prod ] # NGINX Service Mesh tracing settings. Deprecated in favor of telemetry. # Cannot be set when telemetry is set. # If deploying with tracing, uncomment the following object and set the telemetry object to {}. tracing: # The address of a tracing server deployed in your Kubernetes cluster. # Address should be in the format <service-name>.<namespace>:<service_port>. address: "jaeger-agent.monitor:6831" # The tracing backend that you want to use. # Valid values: datadog, jaeger, zipkin backend: "jaeger" # The sample rate to use for tracing. Float between 0 and 1. sampleRate: 1 mtls: # mTLS mode for pod-to-pod communication. # Valid values: off, permissive, strict mode: "strict" # Use persistent storage; "on" assumes that a StorageClass exists. # Valid values: on, off persistentStorage: "off" |
- 29行目でPrometheus、45行目・49行目でJaegerの設定を指定します
- 52行目ですが、この例ではTraceの情報の結果を容易に確認するため、SampleRate 1 と指定します
- 33,37行目 Injectの対象となるNamespaceを指定
NSMをデプロイします
cd ~/nginx-service-mesh/helm-chart
cp ~/f5j-nginx-observability-lab/prep/helm/nsm-values.yaml .
helm upgrade --install nsm -f nsm-values.yaml . \
--namespace nginx-mesh \
--create-namespace
- -f オプションで先程のファイルをしていすることにより、Helmのデプロイのパラメータとして付与します
- –namespace オプションでHelmで展開するNamespaceを指定します
- –create-namespace により対象のNamespaceが存在しない場合、Helmコマンド実行時に作成します
1 2 3 4 5 6 7 8 9 | Release "nsm" does not exist. Installing it now. NAME: nsm LAST DEPLOYED: Thu Jun 30 06:46:04 2022 NAMESPACE: nginx-mesh STATUS: deployed REVISION: 1 TEST SUITE: None NOTES: NGINX Service Mesh has been installed. Ensure all NGINX Service Mesh Pods are in the Ready state before deploying your apps. |
デプロイの結果を確認します
helm list -n nginx-mesh
1 2 | NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION nsm nginx-mesh 1 2022-06-30 06:46:04.963589733 +0000 UTC deployed nginx-service-mesh-0.4.1 1.4.1 |
Podが正しく作成され、以下のようになることを確認してください
kubectl get pod -n nginx-mesh
1 2 3 4 5 6 | NAME READY STATUS RESTARTS AGE nats-server-cf97cf4f4-9ggnq 2/2 Running 0 92s nginx-mesh-api-5c99b4df77-8kmw9 1/1 Running 0 92s nginx-mesh-metrics-5d856c4dfc-fhw7d 1/1 Running 0 92s spire-agent-x4smj 1/1 Running 0 93s spire-server-66c596b85c-gfkz2 2/2 Running 0 92s |
3. NICのセットアップ
必要なファイルを取得します
ファイルを取得します
cd ~/
git clone https://github.com/nginxinc/kubernetes-ingress.git --branch v2.4.1
cd ~/kubernetes-ingress/
取得した内容が意図したVersionであることを確認します
## cd ~/kubernetes-ingress/
git show -s
1 2 3 4 5 6 7 | commit 413c0bb5761b1796d2e8490f4bb34881e144ab8d (HEAD, tag: v2.4.1) Author: Jakub Jarosz <99677300+jjngx@users.noreply.github.com> Date: Thu Oct 20 00:07:37 2022 +0100 Release 2.4.1 (#3184) Co-authored-by: Luca Comellini <luca.com@gmail.com> |
NAP DoS の Arbitator をデプロイします
cd ~/kubernetes-ingress/deployments/helm-chart-dos-arbitrator
helm upgrade --install appdos-arbitrator . \
--namespace nginx-ingress \
--create-namespace
1 2 3 4 5 6 7 | Release "appdos-arbitrator" does not exist. Installing it now. NAME: appdos-arbitrator LAST DEPLOYED: Tue Jun 28 12:32:37 2022 NAMESPACE: nginx-ingress STATUS: deployed REVISION: 1 TEST SUITE: None |
デプロイの結果を確認します
helm list -n nginx-ingress
1 2 | NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION appdos-arbitrator nginx-ingress 1 2022-06-28 12:32:37.157945967 +0000 UTC deployed nginx-appprotect-dos-arbitrator-0.1.0 1.1.0 |
Podが正しく作成され、以下のようになることを確認してください
kubectl get pod -n nginx-ingress | grep dos
1 | appdos-arbitrator-nginx-appprotect-dos-arbitrator-844bdf64qjw9l 1/1 Running 0 23s |
cd ~/kubernetes-ingress/
cp ~/nginx-repo* .
ls nginx-repo.*
make debian-image-nap-dos-plus PREFIX=registry.example.com/root/nic/nginxplus-ingress-nap-dos TARGET=container TAG=2.4.1
docker login registry.example.com
Username: root << 左の文字列を入力
Password: password << 左の文字列を入力
docker push registry.example.com/root/nic/nginxplus-ingress-nap-dos:2.4.1
NICをデプロイします。
nic1
と、nic2
をデプロイします。nic1
で指定するパラメータの内容を確認します。cat ~/f5j-nginx-observability-lab/prep/helm/nic1-addvalue.yaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | nginxServiceMesh: enable: true enableEgress: true controller: nginxplus: true image: repository: registry.example.com/root/nic/nginxplus-ingress-nap-dos tag: "2.4.1" ## Support for App Protect appprotect: enable: true ## Support for App Protect Dos appprotectdos: enable: true ingressClass: nginx ## Enable the custom resources. enableCustomResources: true ## Enable preview policies. This parameter is deprecated. To enable OIDC Policies please use controller.enableOIDC instead. enablePreviewPolicies: false ## Enable OIDC policies. enableOIDC: true globalConfiguration: ## Creates the GlobalConfiguration custom resource. Requires controller.enableCustomResources. create: true ## The spec of the GlobalConfiguration for defining the global configuration parameters of the Ingress Controller. spec: {} # listeners: # - name: dns-udp # port: 5353 # protocol: UDP # - name: dns-tcp # port: 5353 # protocol: TCP ## Enable custom NGINX configuration snippets in Ingress, VirtualServer, VirtualServerRoute and TransportServer resources. enableSnippets: true service: ## Creates a service to expose the Ingress Controller pods. create: true ## The type of service to create for the Ingress Controller. type: NodePort ## Enable collection of latency metrics for upstreams. Requires prometheus.create. enableLatencyMetrics: true prometheus: ## Expose NGINX or NGINX Plus metrics in the Prometheus format. create: true ## Configures the port to scrape the metrics. port: 9113 ## Specifies the namespace/name of a Kubernetes TLS Secret which will be used to protect the Prometheus endpoint. secret: "" ## Configures the HTTP scheme used. scheme: http |
- 1-3行目でNSMとの接続を有効にしています
- 6-9行目でNGINX Plusを有効にし、先程作成したImageを指定しています
- 12-13行目でNAP WAFを、16-17行目でNAP DoSを有効にしています
- 19行目でIngress Classとして
nginx
を指定しています - 56-67行目でPrometheusに必要なパラメータを指定しています
続けて nic2
で指定するパラメータの内容を確認します。
nic1 との差分を中心に確認します
cat ~/f5j-nginx-observability-lab/prep/helm/nic2-addvalue.yaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | nginxServiceMesh: enable: false enableEgress: false controller: nginxplus: true image: repository: registry.example.com/root/nic/nginxplus-ingress-nap-dos tag: "2.4.1" ## Support for App Protect appprotect: enable: true ## Support for App Protect Dos appprotectdos: enable: true ingressClass: nginx2 ## Enable the custom resources. enableCustomResources: true ## Enable preview policies. This parameter is deprecated. To enable OIDC Policies please use controller.enableOIDC instead. enablePreviewPolicies: false ## Enable OIDC policies. enableOIDC: true globalConfiguration: ## Creates the GlobalConfiguration custom resource. Requires controller.enableCustomResources. create: true ## The spec of the GlobalConfiguration for defining the global configuration parameters of the Ingress Controller. spec: {} # listeners: # - name: dns-udp # port: 5353 # protocol: UDP # - name: dns-tcp # port: 5353 # protocol: TCP ## Enable custom NGINX configuration snippets in Ingress, VirtualServer, VirtualServerRoute and TransportServer resources. enableSnippets: true service: ## Creates a service to expose the Ingress Controller pods. create: true ## The type of service to create for the Ingress Controller. type: NodePort ## Enable collection of latency metrics for upstreams. Requires prometheus.create. enableLatencyMetrics: true prometheus: ## Expose NGINX or NGINX Plus metrics in the Prometheus format. create: true ## Configures the port to scrape the metrics. port: 9113 ## Specifies the namespace/name of a Kubernetes TLS Secret which will be used to protect the Prometheus endpoint. secret: "" ## Configures the HTTP scheme used. scheme: http |
- NSMとの接続を利用しないため、1-3行目の設定を無効(false)にしています
- 19行目でIngress Classとして nginx2 を指定しています。 (nic1はnginx)
NICをそれぞれデプロイします
cd ~/kubernetes-ingress/deployments/helm-chart
cp ~/f5j-nginx-observability-lab/prep/helm/nic1-addvalue.yaml .
cp ~/f5j-nginx-observability-lab/prep/helm/nic2-addvalue.yaml .
helm upgrade --install nic1 -f nic1-addvalue.yaml . -n nginx-ingress
helm upgrade --install nic2 -f nic2-addvalue.yaml . -n nginx-ingress
デプロイした結果を確認します
helm list -n nginx-ingress
1 2 3 4 | NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION appdos-arbitrator nginx-ingress 1 2022-06-28 22:45:48.828679008 +0000 UTC deployed nginx-appprotect-dos-arbitrator-0.1.0 1.1.0 nic1 nginx-ingress 1 2022-06-30 07:43:18.437887299 +0000 UTC deployed nginx-ingress-0.13.2 2.2.2 nic2 nginx-ingress 1 2022-06-30 07:44:26.615809096 +0000 UTC deployed |
Podが正しく作成されていることを確認します
kubectl get pod -n nginx-ingress
1 2 3 4 | NAME READY STATUS RESTARTS AGE appdos-arbitrator-nginx-appprotect-dos-arbitrator-844bdf64qjw9l 1/1 Running 1 (25h ago) 32h nic1-nginx-ingress-69d574d9fb-lnv9f 1/1 Running 0 81s nic2-nginx-ingress-857cf9d78d-vzh9w 1/1 Running 0 12s |
NICへ通信を転送するための設定を行います。
NodePortの情報を確認します。
kubectl get svc -n nginx-ingress | grep nginx-ingress
1 2 | nic1-nginx-ingress NodePort 10.104.228.200 <none> 80:31430/TCP,443:32486/TCP 154m nic2-nginx-ingress NodePort 10.106.138.240 <none> 80:30730/TCP,443:31903/TCP 152m |
それぞれに表示されているポート番号を確認してください。これらの情報を元に、NGINXの設定を作成します。
vi ~/f5j-nsm-lab/prep/nginx.conf
以下の内容を参考に、先程確認したNodePortで割り当てられたポート番号宛に通信を転送するように、NGINXを設定します。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # TCP/UDP load balancing # stream { ## TCP/UDP LB for NIC/NSM ingressclass server { listen 80; proxy_pass localhost:31430; # nic1 http port of NodePort } server { listen 443; proxy_pass localhost:32486; # nic 1 https port of NodePort } ## TCP/UDP LB for NIC2 nginx2 ingressclass server { listen 8080; proxy_pass localhost:30730; # nic2 http port of NodePort } server { listen 8443; proxy_pass localhost:31903; # nic2 https port of NodePort } } |
設定をコピーし、反映します
sudo cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf-
sudo cp ~/f5j-nsm-lab/prep/nginx.conf /etc/nginx/nginx.conf
sudo nginx -s reload
監視コンポーネントのデプロイ
1. Prometheusのデプロイ
Helmを使って設定されるDefault設定と、NIC、NSMのステータスを取得するために必要となるPrometheusの設定を追加します。
Prometheusについては以下のページを参照してください。
Prometheusの設定を確認します。
cat ~/f5j-nginx-observability-lab/prep/helm/prometheus-nginx-mesh-and-ingress-scrape-config.yaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | - job_name: 'nginx-mesh-sidecars' kubernetes_sd_configs: - role: pod relabel_configs: - source_labels: [__meta_kubernetes_pod_container_name] action: keep regex: nginx-mesh-sidecar - action: labelmap regex: __meta_kubernetes_pod_label_nsm_nginx_com_(.+) - action: labeldrop regex: __meta_kubernetes_pod_label_nsm_nginx_com_(.+) - action: labelmap regex: __meta_kubernetes_pod_label_(.+) - source_labels: [__meta_kubernetes_namespace] action: replace target_label: namespace - source_labels: [__meta_kubernetes_pod_name] action: replace target_label: pod - job_name: 'nginx-plus-ingress' kubernetes_sd_configs: - role: pod relabel_configs: - source_labels: [__meta_kubernetes_pod_container_name] action: keep regex: nginx-plus-ingress - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape] action: keep regex: true - source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port] action: replace target_label: __address__ regex: (.+)(?::\d+);(\d+) replacement: $1:$2 - source_labels: [__meta_kubernetes_namespace] action: replace target_label: namespace - source_labels: [__meta_kubernetes_pod_name] action: replace target_label: pod - action: labelmap regex: __meta_kubernetes_pod_label_nsm_nginx_com_(.+) - action: labeldrop regex: __meta_kubernetes_pod_label_nsm_nginx_com_(.+) - action: labelmap regex: __meta_kubernetes_pod_label_(.+) - action: labelmap regex: __meta_kubernetes_pod_annotation_nsm_nginx_com_enable_(.+) metric_relabel_configs: - source_labels: [__name__] regex: 'nginx_ingress_controller_upstream_server_response_latency_ms(.+)' target_label: __name__ replacement: 'nginxplus_upstream_server_response_latency_ms$1' - source_labels: [__name__] regex: 'nginx_ingress_nginxplus(.+)' target_label: __name__ replacement: 'nginxplus$1' - source_labels: [service] target_label: dst_service - source_labels: [resource_namespace] target_label: dst_namespace - source_labels: [pod_owner] regex: '(.+)\/(.+)' target_label: dst_$1 replacement: $2 - action: labeldrop regex: pod_owner - source_labels: [pod_name] target_label: dst_pod |
- 1行目がNGINX Service Meshの設定の設定です
- 20行目がNGINX Ingress Controllerの設定です
--set-file extraScrapeConfigs
のオプションで指定します。kubernetes_sd_configs
で Pod
を指定し、PrometheusがPodのMetricsをScarpeします。詳細は以下のページを参照してください。今回はテスト用途でPersistentVolumeを利用しないため、設定を無効にします
cat ~/f5j-nginx-observability-lab/prep/helm/prometheus-addvalue.yaml
1 2 3 4 5 6 | alertmanager: persistentVolume: enabled: false server: persistentVolume: enabled: false |
Prometheusをデプロイします
cd ~/f5j-nginx-observability-lab/prep/helm/
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm upgrade --install prometheus prometheus-community/prometheus \
-f prometheus-addvalue.yaml \
--set-file extraScrapeConfigs=prometheus-nginx-mesh-and-ingress-scrape-config.yaml \
--namespace monitor \
--create-namespace
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | Release "prometheus" does not exist. Installing it now. NAME: prometheus LAST DEPLOYED: Thu Jun 30 08:29:17 2022 NAMESPACE: monitor STATUS: deployed REVISION: 1 TEST SUITE: None NOTES: The Prometheus server can be accessed via port 80 on the following DNS name from within your cluster: prometheus-server.monitor.svc.cluster.local Get the Prometheus server URL by running these commands in the same shell: export POD_NAME=$(kubectl get pods --namespace monitor -l "app=prometheus,component=server" -o jsonpath="{.items[0].metadata.name}") kubectl --namespace monitor port-forward $POD_NAME 9090 ################################################################################# ###### WARNING: Persistence is disabled!!! You will lose your data when ##### ###### the Server pod is terminated. ##### ################################################################################# The Prometheus alertmanager can be accessed via port 80 on the following DNS name from within your cluster: prometheus-alertmanager.monitor.svc.cluster.local Get the Alertmanager URL by running these commands in the same shell: export POD_NAME=$(kubectl get pods --namespace monitor -l "app=prometheus,component=alertmanager" -o jsonpath="{.items[0].metadata.name}") kubectl --namespace monitor port-forward $POD_NAME 9093 ################################################################################# ###### WARNING: Persistence is disabled!!! You will lose your data when ##### ###### the AlertManager pod is terminated. ##### ################################################################################# ################################################################################# ###### WARNING: Pod Security Policy has been moved to a global property. ##### ###### use .Values.podSecurityPolicy.enabled with pod-based ##### ###### annotations ##### ###### (e.g. .Values.nodeExporter.podSecurityPolicy.annotations) ##### ################################################################################# The Prometheus PushGateway can be accessed via port 9091 on the following DNS name from within your cluster: prometheus-pushgateway.monitor.svc.cluster.local Get the PushGateway URL by running these commands in the same shell: export POD_NAME=$(kubectl get pods --namespace monitor -l "app=prometheus,component=pushgateway" -o jsonpath="{.items[0].metadata.name}") kubectl --namespace monitor port-forward $POD_NAME 9091 For more information on running Prometheus, visit: https://prometheus.io/ |
デプロイした結果を確認します
helm list -n monitor | grep prometheus
1 | prometheus monitor 1 2022-06-30 08:29:17.059609279 +0000 UTC deployed prometheus-15.10.1 2.34.0 |
Podが正しく作成されていることを確認します
kubectl get pod -n monitor | grep prometheus
1 2 3 4 5 | prometheus-alertmanager-6b5498dfc7-l5pdj 2/2 Running 0 70s prometheus-kube-state-metrics-748fc7f64-scxqh 1/1 Running 0 69s prometheus-node-exporter-wqh9d 1/1 Running 0 70s prometheus-pushgateway-b6c9dc7db-6xgb4 1/1 Running 0 69s prometheus-server-656659dfc6-fkwwm 2/2 Running 0 69s |
2. Grafana Lokiのデプロイ
Helmを使って設定されるDefault設定では、LokiをデプロイするとKubernets Nodeに保存されているPodのログを取得します。 取得したログに対し、運用でログの調査が容易となるよう設定を追加します
またこのデプロイでは、Lokiの他、Promtail、Grafanaをデプロイします。
Lokiの設定パラメータについては以下のページを参照してください。
HelmでデプロイするLokiの設定を確認します。
cat ~/f5j-nginx-observability-lab/prep/helm/loki-scrape.yaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | - job_name: kubernetes-pods pipeline_stages: - cri: {} - json: expressions: log: - labels: log: - match: pipeline_name: "accesslog" selector: '{namespace="nginx-ingress"} |~ "logtype##: ##accesslog"' stages: - json: expressions: log: - replace: expression: "(\"+)" replace: "%22" source: log - replace: expression: "(##)" replace: "\"" source: log - output: source: log - match: pipeline_name: "securitylog" selector: '{namespace="nginx-ingress"} |~ "logtype##: ##securitylog"' stages: - json: expressions: log: - replace: expression: "(N/A)" replace: "-" source: log - replace: expression: "(\"+)" replace: "%22" source: log - replace: expression: "(##)" replace: "\"" source: log - output: source: log kubernetes_sd_configs: - role: pod relabel_configs: - source_labels: - __meta_kubernetes_pod_controller_name regex: ([0-9a-z-.]+?)(-[0-9a-f]{8,10})? action: replace target_label: __tmp_controller_name - source_labels: - __meta_kubernetes_pod_label_app_kubernetes_io_name - __meta_kubernetes_pod_label_app - __tmp_controller_name - __meta_kubernetes_pod_name regex: ^;*([^;]+)(;.*)?$ action: replace target_label: app - source_labels: - __meta_kubernetes_pod_label_app_kubernetes_io_component - __meta_kubernetes_pod_label_component regex: ^;*([^;]+)(;.*)?$ action: replace target_label: component - action: replace source_labels: - __meta_kubernetes_pod_node_name target_label: node_name - action: replace source_labels: - __meta_kubernetes_namespace target_label: namespace - action: replace replacement: $1 separator: / source_labels: - namespace - app target_label: job - action: replace source_labels: - __meta_kubernetes_pod_name target_label: pod - action: replace source_labels: - __meta_kubernetes_pod_container_name target_label: container - action: replace replacement: /var/log/pods/*$1/*.log separator: / source_labels: - __meta_kubernetes_pod_uid - __meta_kubernetes_pod_container_name target_label: __path__ - action: replace regex: true/(.*) replacement: /var/log/pods/*$1/*.log separator: / source_labels: - __meta_kubernetes_pod_annotationpresent_kubernetes_io_config_hash - __meta_kubernetes_pod_annotation_kubernetes_io_config_hash - __meta_kubernetes_pod_container_name target_label: __path__ |
- 50-51行目で
kubernetes_sd_configs
のpod
を指定し、各Nodeに記録されているPodのログを取得する設定となっています。50行目以降がHelmでデプロイする際のデフォルトの設定となります - 2行目の
cri
で取得したログを、3-8行目で json でパースし、log 部分を抽出します - 10-26行目は、8行目までで抽出した log の内容に対し、 match ステージでNGINXの
accesslog
の条件を指定しログを抽出します - 28-48行目は、10-26行目同様に match ステージでNAP WAFの
securitylog
の条件を指定しログを抽出します
参考の追加設定としてSyslog Serverの設定を追加します
cat ~/f5j-nginx-observability-lab/prep/helm/loki-scrape-addvalue.yaml
1 2 3 4 5 6 7 8 9 | # this is extraScrapeCOnfig - job_name: syslog syslog: listen_address: 0.0.0.0:1514 labels: job: "syslog" relabel_configs: - source_labels: ['__syslog_message_hostname'] target_label: 'host' |
その他Lokiの設定パラメータは以下を参照してください
Lokiをデプロイします
## cd ~/f5j-nginx-observability-lab/prep/helm/
helm repo add grafana https://grafana.github.io/helm-charts
helm upgrade --install loki grafana/loki-stack -n monitor \
--set grafana.enabled=true \
--set-file promtail.config.snippets.extraScrapeConfigs=loki-scrape-addvalue.yaml \
--set-file promtail.config.snippets.scrapeConfigs=loki-scrape.yaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Release "loki" does not exist. Installing it now. W0630 10:11:21.164451 201978 warnings.go:70] policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+ W0630 10:11:21.167201 201978 warnings.go:70] policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+ W0630 10:11:21.169425 201978 warnings.go:70] policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+ W0630 10:11:21.345337 201978 warnings.go:70] policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+ W0630 10:11:21.346284 201978 warnings.go:70] policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+ W0630 10:11:21.346657 201978 warnings.go:70] policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+ NAME: loki LAST DEPLOYED: Thu Jun 30 10:11:19 2022 NAMESPACE: monitor STATUS: deployed REVISION: 1 NOTES: The Loki stack has been deployed to your cluster. Loki can now be added as a datasource in Grafana. See http://docs.grafana.org/features/datasources/loki/ for more detail. |
デプロイした結果を確認します
helm list -n monitor | grep loki
1 | loki monitor 1 2022-06-30 10:11:19.749832951 +0000 UTC deployed loki-stack-2.6.5 v2.4.2 |
Podが正しく作成されていることを確認します
kubectl get pod -n monitor | grep loki
1 2 3 4 | loki-0 1/1 Running 0 2m19s loki-grafana-668cc48b7f-4t5cq 2/2 Running 0 2m19s loki-promtail-gcqck 1/1 Running 0 2m19s loki-promtail-xfznr 1/1 Running 0 2m19s |
3. Jaegerのデプロイ
Jaegerについては以下を参照してください。
cat ~/f5j-nginx-observability-lab/prep/helm/jaeger-addvalues.yaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | provisionDataStore: cassandra: false elasticsearch: false kafka: false allInOne: enabled: true # image: jaegertracing/all-in-one # tag: 1.29.0 ingress: enabled: false collector: enabled: false query: enabled: false agent: enabled: false |
- 6-7行目で
allInOne
の形式でデプロイすることを指定し、その他パラメータでふおうな設定を解除します
Jaegerの設定パラメータについては以下のページを参照してください。
Jaegerをデプロイします
## cd ~/f5j-nginx-observability-lab/prep/helm/
helm repo add jaegertracing https://jaegertracing.github.io/helm-charts
helm upgrade --install jaeger jaegertracing/jaeger -n monitor -f jaeger-addvalues.yaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | Release "jaeger" does not exist. Installing it now. NAME: jaeger LAST DEPLOYED: Thu Jun 30 10:37:49 2022 NAMESPACE: monitor STATUS: deployed REVISION: 1 TEST SUITE: None NOTES: ################################################################### ### IMPORTANT: Ensure that storage is explicitly configured ### ### Default storage options are subject to change. ### ### ### ### IMPORTANT: The use of <component>.env: {...} is deprecated. ### ### Please use <component>.extraEnv: [] instead. ### ################################################################### You can log into the Jaeger Query UI here: export POD_NAME=$(kubectl get pods --namespace monitor -l "app.kubernetes.io/instance=jaeger,app.kubernetes.io/com ponent=query" -o jsonpath="{.items[0].metadata.name}") echo http://127.0.0.1:8080/ kubectl port-forward --namespace monitor $POD_NAME 8080:16686 |
デプロイした結果を確認します
helm list -n monitor | grep jaeger
1 | jaeger monitor 1 2022-06-30 10:37:49.835438814 +0000 UTC deployed jaeger-0.56.8 1.30.0 |
Podが正しく作成されていることを確認します
kubectl get pod,svc -n monitor | grep jaeger
1 2 3 4 | pod/jaeger-7896dffdb6-gmlp8 1/1 Running 0 77s service/jaeger-agent ClusterIP None <none> 5775/UDP,5778/TCP,6831/UDP,6832/UDP 82s service/jaeger-collector ClusterIP None <none> 9411/TCP,14250/TCP,14267/TCP,14268/TCP 82s service/jaeger-query ClusterIP None <none> 16686/TCP,16685/TCP 82s |
Tips1. Helmでパラメータを指定する際の主なデバッグ方法
Prometheusの情報を参考に以下の情報を示します。
- ドキュメントを参照する。取得するHelm Chartや、Chartが参照するGitHubの内容を確認します
- デフォルトの設定でデプロイする
- デプロイした内容を確認する。helm get コマンドを用いて状態を確認できます
$ helm get -h This command consists of multiple subcommands which can be used to get extended information about the release, including: - The values used to generate the release - The generated manifest file - The notes provided by the chart of the release - The hooks associated with the release Usage: helm get [command] Available Commands: all download all information for a named release hooks download all hooks for a named release manifest download the manifest for a named release notes download the notes for a named release values download the values file for a named release
- や 3. の内容を元に設定ファイルパラメータを記述する
- で記述した内容が正しく反映されることを3. の手順を参考に確認する
-f
で指定することで、ファイルの形式でオプションパラメータを指定することができます--set
で、パラメータの値を個別に指定することができます--set-file
で、対象のパラメータに対し、ファイル形式で値を指定することができます
- 意図した動作となっていることを確認する
Tips2. Helmでデプロイするリソースの詳細
Helmを使ってデプロイしたPrometheusについて、どのようなステータスとなっている確認する方法紹介します
以下コマンドを実行し、出力結果を確認します
helm get all prometheus -n monitor | less
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | NAME: prometheus LAST DEPLOYED: Thu Jun 30 08:38:08 2022 NAMESPACE: monitor STATUS: deployed REVISION: 1 TEST SUITE: None USER-SUPPLIED VALUES: alertmanager: persistentVolume: enabled: false extraScrapeConfigs: |+ - job_name: 'nginx-mesh-sidecars' kubernetes_sd_configs: - role: pod **省略** COMPUTED VALUES: alertRelabelConfigs: null alertmanager: **省略** persistentVolume: accessModes: - ReadWriteOnce annotations: {} enabled: false **省略** extraScrapeConfigs: |+ - job_name: 'nginx-mesh-sidecars' kubernetes_sd_configs: - role: pod relabel_configs: **省略** HOOKS: MANIFEST: --- # Source: prometheus/charts/kube-state-metrics/templates/serviceaccount.yaml apiVersion: v1 kind: ServiceAccount |
helm get all
を指定すると全ての情報を確認することができます- helm 実行時に入力した情報は
USER-SUPPLIED VALUES
に表示されます COMPUTED VALUES
に適用される値が表示されます。実行時に値の指定がない場合には、Templateのデフォルトの内容が表示されます
アプリケーションの外部公開・必要な設定のデプロイ
1. NGINX Ingress Controllerの設定
外部からアプリケーションに接続するため、NGINX Ingress Controllerを設定します。 また、今回はNIC、NAP WAFのログをGrafana Lokiで管理するため、すでに設定したLokiの設定に合わせたフォーマットでログを出力するよう設定します。
cd ~/f5j-nginx-observability-lab/prep/nic
# for access observability tools
kubectl apply -f monitor-jaeger-vs.yaml
kubectl apply -f monitor-loki-grafana-vs.yaml
kubectl apply -f monitor-prometheus-vs.yaml
# for changing NIC custom log format
kubectl apply -f nic1-custom_log_format.yaml
kubectl apply -f nic2-custom_log_format.yaml
デプロイした結果を確認します
kubectl get vs -A
1 2 3 4 5 | NAMESPACE NAME STATE HOST IP PORTS AGE monitor loki-grafana-vs Valid grafana.example.com 26s monitor jaeger-vs Valid jaeger.example.com 32s monitor prometheus-vs Valid prometheus.example.com 40s staging bookinfo-vs Valid bookinfo.example.com 96s |
kubectl get aplogconf,appolicy,policy -n staging
1 2 3 4 5 6 7 8 | NAME AGE aplogconf.appprotect.f5.com/logconf 83s NAME AGE appolicy.appprotect.f5.com/simple-ap 87s NAME STATE AGE policy.k8s.nginx.org/waf-policy Valid 80s |
踏み台ホストのブラウザ(Chrome)よりそれぞれのサービスのURLへアクセスいただくことにより、画面をご覧頂くことが可能です。
Prometheus: http://prometheus.example.com:8080/
Jaeger: http://jaeger.example.com:8080/
Grafana: http://grafana.example.com:8080/
2. Grafana Datasouce の追加
踏み台サーバのデスクトップのショートカットから Chrome
を実行し、以下のURLにアクセスします
ログイン画面が表示されます。
Grafanaにログインするためにパスワードの情報を取得します。
kubectl get secret --namespace monitor loki-grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
1 | jFQSgKatKfJQ816K81qkPYIB2v6FvYjyAPE5mnpt |
ユーザ名 admin
、そして確認したパスワードを入力しログインしてください
画面左メニューの Configuration (歯車のマーク)
> DataSource
を開き、 Add data source
をクリックしてください
DataSourceにPrometheusの追加をします
URL に http://prometheus-server と入力し、 Save & test
をクリックしてください
DataSourceにJaegerの追加をします
URL に http://jaeger-query:16686 と入力し、
Filter by Trace ID
、 Filter by Span ID
、 Enable Node Graph
を有効にしてください。
その後、 Save & test
をクリックしてください。
Lokiはデプロイ時点で設定されています。以下のような結果になることを確認してください
3. サンプルアプリケーションのデプロイ
サンプルアプリケーションに必要となる、NGINX Ingress Controllerを設定します。
# for access bookinfo application with NAP WAF / custom log format
kubectl apply -f simple-ap.yaml -n staging
kubectl apply -f ap-logconf.yaml -n staging
kubectl apply -f waf.yaml -n staging
kubectl apply -f staging-bookinfo-nap-vs.yaml
NSM Labで利用した bookinfo のアプリケーションをデプロイします。 詳細は NSM サンプルアプリケーションのデプロイ を参照してください
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.13/samples/bookinfo/platform/kube/bookinfo.yaml -n staging
kubectl get pod -n staging
1 2 3 4 5 6 7 | NAME READY STATUS RESTARTS AGE details-v1-7f4669bdd9-87hp5 2/2 Running 0 2m21s productpage-v1-5586c4d4ff-mjsr9 2/2 Running 0 2m20s ratings-v1-6cf6bc7c85-zzbsc 2/2 Running 0 2m21s reviews-v1-7598cc9867-djmm8 2/2 Running 0 2m21s reviews-v2-6bdd859457-gt6wb 2/2 Running 0 2m21s reviews-v3-6c98f9d7d7-f8jk8 2/2 Running 0 2m21s |
監視コンポーネントのダッシュボードのデプロイ・モニタリング
1. Dashboardのデプロイ
Grafana 左側のメニュー +
にマウスカーソルを合わせ、 Import
をクリックし、DashboardのImport画面を開いてください
以下の画面が表示されますので、各DashboardをImportしてください
1. NIC Dashboard
Import画面を開き、以下のURLの内容をコピーし Import via panel json
に貼り付け、 Load
をクリックしてください
Jsonの読み込みに成功すると、以下の画面が表示されるので Prometheus
の欄にGrafanaのDatasourceから Prometheus
を選択し、 Import
をクリックしてください
2. NSM Dashboard
Import画面を開き、以下のURLの内容をコピーし Import via panel json
に貼り付け、 Load
をクリックしてください
Jsonの読み込みに成功すると、以下の画面が表示されるので Prometheus
の欄にGrafanaのDatasourceから Prometheus
を選択し、 Import
をクリックしてください
3. Loki Dashboard
Import画面を開き、以下のURLの内容をコピーし Import via panel json
に貼り付け、 Load
をクリックしてください
Jsonの読み込みに成功すると、以下の画面が表示されるので Loki
の欄にGrafanaのDatasourceから Loki
を選択し、 Import
をクリックしてください
2. デモトラフィックの実行
以下コマンドを実行し、デモトラフィックを実行してください
while : ; do echo "Demo Traffic Start!!" ; \
bash ~/f5j-nginx-observability-lab/demotraffic/attack-to-bookinfo.sh ; \
bash ~/f5j-nginx-observability-lab/demotraffic/dummy-access-to-bookinfo.sh ; \
bash ~/f5j-nginx-observability-lab/demotraffic/other-traffic.sh ; \
done ;
1 2 3 4 5 6 7 8 9 10 | Demo Traffic Start!! Thu Jul 7 12:11:53 UTC 2022 attack to bookinfo start done Thu Jul 7 12:12:13 UTC 2022 dummy access to bookinfo start done Thu Jul 7 12:12:33 UTC 2022 other traffic start ... (以下ループ) |
3. ステータスの確認
Note
ダッシュボードに結果が反映するまで時間がかかる場合があります 正しく読み込まれない場合などは、対象のダッシュボードを再度開き、状態を確認してください
1. NIC Dashboard
画面左上 NIC
から対象のNICを選択できます。情報を確認したい NIC
を選択してください
Success Rates Over Time
のグラフを参考に詳細を確認します
View
: 対象の項目を画面全体で確認できます
Edit
: 表示内容の条件など詳細を確認、変更することができます。変更内用を表示に反映する場合には右上のApply
、 Dashboardに反映する場合にはSave
をクリックしてください。変更を破棄する場合にはDiscard
をクリックしてください。
Explore
: 表示の詳細を確認できます
Inspect
>Data
: 表示内容の値を確認できます
Tips1. 各種ステータスの確認
Grafana の Explore より、各データソースの詳細を確認することが可能です
Prometheus ステータスの確認
Metric Browser をクリックし、Prometheusが取得したMetricsを確認できます
PrometheusはPromQLという書式で様々にMetricsを操作し、情報を出力することが可能です。 PromQLについては以下のドキュメントを参照してください。
Loki ステータスの確認
LokiはLogQLという書式で様々にMetricsを操作し、情報を出力することが可能です。 LogQLについては以下のドキュメントを参照してください。
Log browser 右側にLogQLで記述した条件を入力し、 Ctrl + Enter
または 画面右上の Run query
をクリックすると結果が表示されます
{namespace="nginx-ingress"} | json | logtype="securitylog" | bot_signature_name="curl"
{namespace=”nginx-ingress”} | 対象のログを示すラベルの指定 |
| json | json 形式でログデータをパース |
| logtype=”securitylog” | logtype が securitylog のログをフィルタ |
| bot_signature_name=”curl” | bot_signature_name が curl のログをフィルタ |
{namespace="nginx-ingress"} | json | logtype="accesslog" | server_name="grafana.example.com"
{namespace=”nginx-ingress”} | 対象のログを示すラベルの指定 |
| json | json 形式でログデータをパース |
| logtype=”accesslog” | logtype が accesslog のログをフィルタ |
| server_name=”grafana.example.com” | server_name が grafana.example.com のログをフィルタ |
sum by (server_name) (count_over_time(
{namespace="nginx-ingress"} | json | logtype="accesslog"
[5m]))
sum by (server_name)( | 抽出した条件の結果を合計し、指定のパラメータごとに表示 |
count_over_time( | 指定した期間のログをカウント |
{namespace=”nginx-ingress”} | 対象のログを示すラベルの指定 |
| json | json 形式でログデータをパース |
| logtype=”accesslog” | logtype が accesslog のログをフィルタ |
[5m])) | count_over_time の期間を指定 (5m=5分) |
Loki Promtail 設定
Lokiで利用するPromtailの設定について紹介します。
ログデータに対し適切な処理を行うことで、Lokiでのログの閲覧がより容易になります。
Helm Chartの values.yaml config に指定された情報が、 Template の secret.yaml に読み込まれ、 Promtail の設定として反映されます。
記述内容の詳細については、以下のドキュメントを参照して下さい。
ラボの設定ファイルを元に開設します。設定ファイル全体の構成は以下のとおりです。
この設定項目の中で scrape_configs
がLogデータの取得、及び整形・データの抽出を記述する箇所となります。
scrape_configs
を確認します
それぞれ、 loki-scrape-addvalue.yaml
、 loki-scrape.yaml
で指定した内容が設定ファイルに反映されています。
Syslogサーバの参考設定を示す job_name: syslog
はSyslogで受けたLogデータを処理する設定となります。
各Podのログの取得は job_name: kubernetes-pods
に記述しています。
scrape_configs
では大きく分けて以下の設定を記述します
- Scraping (Service Discovery):
- ログデータを取得します。
- Scrapeの処理は
Kubernetes
、Windows Event
、Journal(Linux)
、syslog
などがあります - Scrapeの内容に応じた情報を持つラベルがあり、それらを元にログの分類やタグ付けが可能です。その処理を
Relabel
で記述します - 詳細は、設定ファイルの記述方法や Grafana Configuring Promtail 、 Grafana Promtail Scraping を確認してください
- Relabel :
- ログデータを条件に従ってラベルの付与(付け替え など)を行います
- Scrapeに応じたラベルが利用可能です。ラベルは予め予約された文字列が利用され、
アンダースコア2つ (__)
から始まる文字列で指定されます - 詳細は、設定ファイルの記述方法や Grafana Configuring Promtail 、 Grafana Promtail Scraping を確認してください
- Pipeline :
- ログデータを各種情報に合わせて、検索、整形、変更、ラベルなどを行います。Pipelineの処理はStageという構成で呼ばれ、記述に合わせた処理を行います
- Pipeline の詳細は Grafana Promtail を参照してください
- Stage の詳細、及び関数の詳細は Grafana Promtail Stages を参照してください
Pipeline
ではログデータに関する処理を記述します。
Stageは Parsing
、 Transoform
、 Action
、 Filtering
の4種類に分類されており、以下のような内容となります。
- Parsing stages: データの構造を指定の内容でパースします
- docker: ログデータをDocker Formatでパースします
- cri: ログデータをCRI Formatでパースします
- json: ログデータをJson Formatでパースします
- Transform stages: ログラインの構成を変更・変形します
- template: GoのTemplateを使って、データを処理します
- Action stages: ログに関連するデータをしていします
- timestamp: ログエントリの時刻情報を指定します
- Filtering stages: 対象とするログの選択や、ログの転送に関する設定をします
- match: 指定した条件に該当するログに対してstageを実行します
各Stage、関数の記述イメージは以下です。
これらの処理により、以下のようにLokiでの操作が簡単になります
- NICのAccess Log(logtype accesslog)、NAP WAFのLog(logtype accesslog)をjsonで容易に扱える様に変更
- NAP WAFのLogでJSONパースでエラーとなる文字列の置換、及び該当データがない場合の文字列をAccess Logと統一
LogQLは柔軟な記述が可能となりますので、ダッシュボードの記述内容も合わせてご確認ください
Tips2. ラボが正しく動作しない場合
対象のリソースを削除し、再度作成する
- helm でデプロイしたリソースの削除
helm uninstall <resouce name> <-n namespace>
- kubectl でデプロイしたリソースの削除
kubectl delete <resource type> <resouce name> <-n namespace> kubectl delete -f <yaml file> <-n namespace>
各リソースへの疎通を確認する
- デモアプリケーションへの疎通を確認する
curl -v -H "Host: bookinfo.example.com" "http://127.0.0.1/productpage" | grep "<title>"
- 各監視ツールへの疎通を確認する
curl -v -H "Host: grafana.example.com" "http://127.0.0.1:8080/login" | grep "<title>" curl -v -H "Host: prometheus.example.com" "http://127.0.0.1:8080/graph" | grep "<title>" curl -v -H "Host: jaeger.example.com" "http://127.0.0.1:8080/" | grep "<title>"
- WAFでブロックされることを確認する
curl -v -H "Host: bookinfo.example.com" "http://127.0.0.1/productpage?a=<script>"