JIRAの更新をSlackやMattermostに通知する
JIRAの更新をSlackやMattermostに通知するBOTを作りました。
このBOTは実際にお仕事で使っていて、いい感じの粒度で通知されるように改善を重ねています。
Dockerで簡単に実行できます。
docker run --rm -p 3000:3000 \ -e SLACK_WEBHOOK=https://hooks.slack.com/... \ int128/jira-to-slack
Kubernetesの場合はHelmで簡単にインストールできます。
helm repo add int128.github.io https://int128.github.io/helm-charts helm repo update helm install int128.github.io/jira-to-slack --set SLACK_WEBHOOK=https://hooks.slack.com/...
JIRAの設定画面でWebhookを追加すれば完了です。
詳しい使い方は下記を参照してください。
EBS volume type standard not working on Kubernetes
The EBS volume type standard
seems not working as a storage class on Kubernetes.
Reproduce the issue
Adding the following storage class:
kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: standard labels: k8s-addon: storage-aws.addons.k8s.io provisioner: kubernetes.io/aws-ebs parameters: type: standard reclaimPolicy: Delete
by the following commands:
kubectl apply -f config/storage-class-standard.yaml kubectl patch storageclass gp2 -p '{"metadata": {"annotations":{"storageclass.beta.kubernetes.io/is-default-class":null}}}' kubectl patch storageclass standard -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
kube-controller-manager said:
I0220 01:40:56.305272 5 aws.go:1246] Found instances in zones map[us-west-2a:{}] I0220 01:40:56.305382 5 util.go:314] Creating volume for PVC "jira-atlassian-jira-software"; chose zone="us-west-2a" from zones=["us-west-2a"] I0220 01:40:56.305424 5 aws_util.go:137] Error creating EBS Disk volume: invalid AWS VolumeType "standard" E0220 01:40:56.305452 5 aws_ebs.go:438] Provision failed: invalid AWS VolumeType "standard" I0220 01:40:56.305517 5 pv_controller.go:1317] failed to provision volume for claim "devops/jira-atlassian-jira-software" with StorageClass "standard": invalid AWS VolumeType "standard"
See also
Prometheus/GrafanaでPersistent Volumesの空き容量を取得する
TL;DR
- KubernetesのPersistent Volumesの容量をPrometheusで取得するには以下のMetricsを使用する。
kubelet_volume_stats_available_bytes
(使用可能バイト数)kubelet_volume_stats_used_bytes
(使用済みバイト数)kubelet_volume_stats_capacity_bytes
(容量)
- Namespaceやノード名などでフィルタできる。
- 削除済みのPersistent Volumesも返されるが、今のところフィルタする方法はなさそう。
具体的な方法と例
HelmでNamespace kube-system
にインストールしたPrometheus 2.1.0とGrafana 4.6.3で確認しています。
- Prometheus: https://github.com/kubernetes/charts/tree/master/stable/prometheus
- Grafana: https://github.com/kubernetes/charts/tree/master/stable/grafana
Grafanaで以下のクエリを指定すると、
- Query:
kubelet_volume_stats_used_bytes / kubelet_volume_stats_capacity_bytes
- Legend:
{{namespace}}/{{persistentvolumeclaim}}
このようなグラフが作成されます。
Prometheusでは以下の情報が取得できるため、Namespaceやノード名などでフィルタすることも可能です。
kubelet_volume_stats_capacity_bytes{ beta_kubernetes_io_arch="amd64", beta_kubernetes_io_instance_type="m3.medium", beta_kubernetes_io_os="linux", failure_domain_beta_kubernetes_io_region="us-west-2", failure_domain_beta_kubernetes_io_zone="us-west-2a", instance="ip-172-20-46-41.us-west-2.compute.internal", job="kubernetes-nodes", kops_k8s_io_instancegroup="nodes", kubernetes_io_hostname="ip-172-20-46-41.us-west-2.compute.internal", kubernetes_io_role="node", namespace="kube-system", node_role_kubernetes_io_node="", persistentvolumeclaim="prometheus-prometheus-server"}
削除済みのPersistent Volumesも返ってきますが、今のところフィルタする方法はなさそうです。