Connect Kubernetes and PagerDuty
Two read only integrations add context to your services. Kubernetes shows which workloads each service runs on. PagerDuty shows who is on call for it and which team owns it. Both write to Skep’s service graph, so owners carry through to findings and recommendations.
What you need
Section titled “What you need”- Plan: any plan.
- Role: an organization admin, signed in as a person. Agents and API keys cannot create or change integrations.
- A read only credential for each system, described below. Skep stores it encrypted and never shows it again.
Kubernetes
Section titled “Kubernetes”What you get
Section titled “What you get”Every five minutes, Skep reads a cluster’s namespaces and workloads (deployments, statefulsets, daemonsets and cronjobs) and adds them to the graph:
- which workloads each service runs on, with desired and ready replicas;
- the team that owns each workload, from its labels and annotations;
- workload, namespace and cluster entities that match the ones your
collectors’
k8s_attributesprocessor reports, so the two sources meet on one entity instead of two.
It only reads. It never reads pods, secrets or config maps, and it never changes the cluster.
What it needs
Section titled “What it needs”Skep must reach the cluster’s API server over HTTPS. For a private cluster, expose the API server to Skep.
Set it up
Section titled “Set it up”-
Create a read only service account. Apply this manifest. It can only get, list and watch the resources the integration reads, and it gets a long-lived token:
apiVersion: v1kind: ServiceAccountmetadata:name: skep-readernamespace: kube-system---apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRolemetadata:name: skep-readerrules:- apiGroups: [""]resources: ["namespaces"]verbs: ["get", "list", "watch"]- apiGroups: ["apps"]resources: ["deployments", "statefulsets", "daemonsets"]verbs: ["get", "list", "watch"]- apiGroups: ["batch"]resources: ["cronjobs"]verbs: ["get", "list", "watch"]---apiVersion: rbac.authorization.k8s.io/v1kind: ClusterRoleBindingmetadata:name: skep-readerroleRef:apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: skep-readersubjects:- kind: ServiceAccountname: skep-readernamespace: kube-system---apiVersion: v1kind: Secretmetadata:name: skep-reader-tokennamespace: kube-systemannotations:kubernetes.io/service-account.name: skep-readertype: kubernetes.io/service-account-tokenwatchis granted for a future streaming mode. Today the integration only lists. To limit it to some namespaces, set Namespaces in step 3, then replace the ClusterRoleBinding with a RoleBinding in each namespace. Keep cluster-widegetonnamespaces. -
Read the token and the cluster CA:
Terminal window kubectl -n kube-system get secret skep-reader-token -o jsonpath='{.data.token}' | base64 -dkubectl -n kube-system get secret skep-reader-token -o jsonpath='{.data.ca\.crt}' | base64 -d -
Add the integration. Open Integrations, choose Add integration, then Kubernetes. Choose the Skep environment the cluster’s collectors report into. Create one integration per cluster. Paste the token and fill in:
Setting Required Meaning API server Yes The API server URL. Must be https (http only for localhost, such as kubectl proxy)Cluster name Yes The k8s.cluster.nameyour collectors set, so both sides name the cluster the same wayCluster CA (PEM) No The token Secret’s ca.crt. When set, it replaces the system roots. TLS verification is never turned offNamespaces No Only these namespaces. Empty means every namespace Owner label and annotation keys No Keys that name the owning team, in order. Default: app.kubernetes.io/part-of,team,ownerService name keys No Keys that name the service, in order. Default: resource.opentelemetry.io/service.name,app.kubernetes.io/name
How workloads map to services
Section titled “How workloads map to services”A workload maps to the services already observed on it through resource
attributes, plus the service its metadata names. The name comes from the
first service name key found on the workload’s annotations or labels, then
its pod template’s. If resource.opentelemetry.io/service.namespace is set,
it must match the service’s service.namespace. Otherwise:
- a name that matches one observed service maps to it;
- if several match, the one whose
service.namespaceequals the Kubernetes namespace wins; - anything still ambiguous is never guessed, and is listed under
ambiguous_workloadsin the sync stats.
When a workload leaves the cluster, the links only this integration reported are turned off. A link your telemetry also reports stays.
Two clusters in one Skep environment that both have a namespace with the same
name share one namespace entity. Skep flags it as ambiguous and lists it under
namespaces_shared_with_other_clusters. Put the clusters in separate
environments if that matters to you.
PagerDuty
Section titled “PagerDuty”What you get
Section titled “What you get”Every five minutes, Skep reads services, teams, escalation policies and current on-calls from PagerDuty, and links each PagerDuty service to the Skep services it covers. Each linked service shows:
- its PagerDuty service, with a link;
- who is on call now, by escalation level;
- the owning team, which becomes the owner of the service and of its new findings.
There is one PagerDuty integration per organization, and it covers every
environment. Agents see the same data in get_service. On-call is as fresh as
the last sync, at most five minutes old. Page people from PagerDuty, not from
Skep.
Set it up
Section titled “Set it up”-
Create a read only key. In PagerDuty, open Integrations, then API Access Keys, and create a key with Read-only API Key checked. A user token from someone who can see every service and schedule works too.
-
Add the integration. Open Integrations, choose Add integration, then PagerDuty. Paste the key.
-
Map services if names differ. Service mapping is JSON from a PagerDuty service ID or name to a Skep service:
{"PABC123": "shop/checkout", "Cart API": "svc:shop/cart"}svc:shop/checkoutorshop/checkoutnames one namespace. A barecheckoutmeans that name in any namespace. Skep looks up the ID before the name. -
Leave Match unmapped services by name on to link the rest by name. Matching lowercases the name, keeps only letters and digits, and drops a trailing
serviceorsvc, soCheckout Service,checkout-svcandcheckoutall match. -
For an EU account, set API URL to
https://api.eu.pagerduty.com.
Skep calls only GET /services, GET /teams, GET /escalation_policies and
GET /oncalls.
Where a name would match several services in one environment (shop/cart
and legacy/cart), Skep skips that environment rather than guess, and lists
it under ambiguous_matches. Add a mapping with a namespace to resolve it.
Who owns a service
Section titled “Who owns a service”Several sources can name a service’s owner. When they disagree, Skep picks the first in this order:
- PagerDuty, because it is who gets paged.
- The
team.nameresource attribute in your telemetry. - CODEOWNERS, from GitHub or GitLab.
- Kubernetes labels and annotations.
Team names match only when they are spelled the same: Payments and
payments are two teams. When a source stops naming a team, ownership falls
back to the next source.
Check that it worked
Section titled “Check that it worked”- The integration shows Last sync with a recent time and its sync stats. Kubernetes: workloads, workloads mapped to services, workloads with an owner. PagerDuty: PagerDuty services, services linked, on-calls.
- A service’s detail page lists its Kubernetes workloads and its PagerDuty service with who is on call.
- Services under Data show an owner with the source
kubernetesorpagerduty.
Troubleshooting
Section titled “Troubleshooting”| What you see | Why | What to do |
|---|---|---|
| Kubernetes: last sync failed with 401 | The token was rejected | Read the token again from the Secret and update the integration |
| Kubernetes: last sync failed with 403 | The service account lacks a permission | Apply the manifest above, or add the missing rule |
| Kubernetes: the sync cannot connect | Skep cannot reach the API server, or the CA does not match | Check the API server URL, network access and the Cluster CA |
| Workloads without a service | No service name key is set on the workload, and no observed service runs on it | Add app.kubernetes.io/name or the OpenTelemetry Operator annotation, or set Service name keys |
| PagerDuty services that link to nothing | No mapping and no name match | The sync stats list PagerDuty services without a Skep service. Add mappings for them |
| The wrong team owns a service | A higher source names another team | Check the order above. PagerDuty wins over the others |
To sync now instead of waiting five minutes, choose Sync now on the integration.