Skip to content

Permissions and policies ​

Inside your namespace you have a lot of freedom, but not unlimited freedom. Two mechanisms draw the line, and they announce themselves differently:

  • RBAC decides which resources you may touch at all. A violation ends in Forbidden.
  • Platform rules decide whether a specific manifest is accepted. A violation ends with your kubectl apply being rejected.

What RBAC grants ​

"Full" below means get, list, watch, create, update, patch and delete. Where a row says something narrower, that is the whole grant.

API groupResourcesAccess
appsdeployments, statefulsets, replicasetsFull
appsdeployments/scale, statefulsets/scaleget, update, patch
"" (core, objects)services, configmaps, secrets, serviceaccounts, persistentvolumeclaimsFull
"" (core, runtime)pods, pods/log, pods/exec, pods/attach, pods/portforward, eventsFull
"" (core, quotas)resourcequotas, limitrangesRead-only
"" (core, endpoints)endpointsRead-only
discovery.k8s.ioendpointslicesRead-only
coordination.k8s.ioleasesFull
events.k8s.ioeventsRead-only
batchjobs, cronjobsFull
autoscalinghorizontalpodautoscalersFull
autoscaling.k8s.ioverticalpodautoscalersFull
policypoddisruptionbudgetsFull
gateway.networking.k8s.iohttproutes, grpcroutesFull
gateway.nginx.orgclientsettingspoliciesFull
postgresql.cnpg.ioclusters, backups, scheduledbackups, poolers, databases, publications, subscriptions, imagecatalogsFull
barmancloud.cnpg.ioobjectstoresFull
k8s.mariadb.commariadbs, databases, users, grants, connections, backups, restores, sqljobs, maxscalesFull
dragonflydb.iodragonfliesFull
keda.shscaledobjects, scaledjobs, triggerauthenticationsFull
metrics.k8s.iopodsget, list

All of it applies inside your namespace only.

Three consequences of the read-only rows are worth stating outright:

  • You cannot change your own quota. You can read it, which is what kubectl get resourcequota and kubectl describe resourcequota are for, but raising it is a plan change, see Billing and quotas.
  • You cannot change the namespace defaults applied to containers that declare no resources.
  • You cannot write endpoints yourself. A Service with a selector gets them automatically, a Service without one has no backends.

Leases are there for leader election and locks. Every PostgreSQL cluster in your namespace keeps one named after itself, which the database relies on, so pick a different name for your own. A pod gets this access only when it runs as your namespace's service account, see Networking.

This table describes what you can do with kubectl. If you deploy by pointing your namespace at a Git repository instead, a few kinds are not accepted through that route even though they appear here, currently vertical pod autoscalers, client settings policies and leases.

Everything else is denied ​

Anything not in the table is not allowed. That notably covers nodes, namespaces, cluster roles and CRD management. Those commands end in Forbidden, see Access and kubectl.

You cannot list the storage classes

kubectl get storageclass is denied as well, so you cannot discover the available classes from inside the cluster. There are two, and they are named and described under Storage.

Platform rules ​

On top of RBAC, the platform checks every manifest against a fixed set of rules. They are hard rules: a manifest that breaks one is rejected.

RuleWhat to do instead
A pod may only use configMap, downwardAPI, emptyDir, ephemeral, persistentVolumeClaim, projected and secret volumesRequest any other storage through a PersistentVolumeClaim
Services of type NodePort, LoadBalancer and ExternalName are not accepted, and neither is spec.externalIPsStay on ClusterIP and publish through an HTTPRoute
You cannot write Certificate resources yourselfLet the certificate come from the annotation on your HTTPRoute
An HTTPRoute must declare at least one hostnameA route with none would attach as a catch-all on the shared gateway
Hostnames must be under your namespace subdomain, or added to your namespace in the portalSee Gateway API
A pod may not choose its own node, may not tolerate the taint of nodes reserved for the platform, and may not carry a toleration that matches everythingLet the scheduler place it. A blanket operator: Exists toleration without a key counts, so do not copy one in. The refusal begins Tenant pods may not tolerate the 'ci' taint
A PodDisruptionBudget must select its pods with matchLabels, set maxUnavailable to at least 1 and leave minAvailable unsetRun at least two replicas and let one of them be disrupted, see node maintenance
No two PodDisruptionBudgets in a namespace may be able to cover the same podGive every budget a matchLabels key that the others also use, with a different value
A PodDisruptionBudget selector may use at most 8 matchLabels, and at most 4 matchExpressions with at most 8 values eachSelect with fewer labels. One matchLabels key that names the workload is usually enough
A namespace may hold at most 20 PodDisruptionBudgets, counting the ones operators create for youCover each workload with one budget and remove the ones you no longer need
The disruption budget of a Dragonfly (spec.pdb), MariaDB or MaxScale (spec.podDisruptionBudget) must set maxUnavailable to at least 1 and leave minAvailable unsetSee node maintenance
A pod may not carry the karpenter.sh/do-not-disrupt annotationProtect it with a PodDisruptionBudget, see node maintenance
A pod may not tolerate the control-plane taint or the taints of a node under maintenance; node.kubernetes.io/not-ready and node.kubernetes.io/unreachable only with effect: NoExecuteRemove the toleration, see node maintenance
A pod may not name a priority class other than tenant-default. One that does is refused with the integer value of priority (500000) must not be provided in pod spec; priority admission controller computed 100 from the given PriorityClass name, the number varying with the classLeave priorityClassName out: the right one is applied for you
A route may not set or add the X-Real-IP, X-Forwarded-For or Forwarded request headersLeave them out: the gateway sets the client address, see Gateway API
A pod may have at most 16 containers and init containers, 32 tolerations, 16 nodeSelector entries, 128 volumes and 8 request and limit entries per container, with image references of at most 512 characters. Some other objects have similar boundsStay within them. The refusal names the bound, see The API said no
A ClientSettingsPolicy may not raise the request body size above 512 MiB, or set it to zeroSet an explicit size within that bound
The HTTP scale-to-zero resources are managed for youUse the itsh.dev/scale-to-zero annotation, see Autoscaling
On the free tier, nfs-rwx is the only permitted storage classSee Free tier
A PostgreSQL Cluster may only run images from ghcr.io/cloudnative-pg/. The Cluster is accepted, but its pods are refusedLeave imageName out or pick an image from there, see Databases
A route on an itsh-apps.dev hostname may not set, add or remove X-Robots-TagLeave the header out: it is always noindex, nofollow there, see Free tier

Sandboxed runtime ​

Your workloads run in a sandboxed runtime. It is applied automatically and you cannot opt out, and for your own workloads there is nothing to notice: it is set for you even if you say nothing.

It surfaces in one place. Managed PostgreSQL pods are the exception to it, and because kubectl exec is only permitted into sandboxed pods, you cannot get a shell in one. See Databases.

Inline volumes: use a PVC ​

Volume types defined directly in the pod are rejected, apart from configMap, downwardAPI, emptyDir, ephemeral, persistentVolumeClaim, projected and secret. That explicitly includes an nfs volume in the pod spec:

yaml
# Rejected
spec:
  volumes:
    - name: data
      nfs:
        server: nfs.example.com
        path: /export/data

If you need shared storage, request it through a PVC on the nfs-rwx class, see Storage:

yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: data
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: nfs-rwx
  resources:
    requests:
      storage: 1Gi

No NodePort, no LoadBalancer ​

The way out is exclusively an HTTPRoute on the shared gateway, see Gateway API. A service with type: LoadBalancer or type: NodePort is rejected; ClusterIP is the type you want.

Certificates come from the route ​

Creating a Certificate resource yourself is rejected. TLS comes from the cert-manager.io/cluster-issuer annotation on your HTTPRoute, without you doing anything else.

Disruption budgets and node maintenance ​

Your pods are moved off a node through the eviction API, so PodDisruptionBudgets apply. That happens for two reasons:

  • Replacement for updates. Every node is replaced about once a week so it runs current security updates. Replacement normally starts between 22:00 and 02:45 UTC. If a budget keeps a pod on its node, that node is replaced separately, at any time of day: a pod still on it after 15 minutes, because its budget allows no disruption or because it is still shutting down, is deleted with at most one more minute to stop. Without that limit, a budget with a pod that never becomes ready would keep its node from ever being patched.
  • Repacking. Between 18:00 and 02:45 and between 07:15 and 10:00 UTC, pods are also moved so that they fit onto fewer or cheaper nodes. Repacking never starts on a node with a pod its budget holds.

To get through both without an interruption, run at least two replicas, label their pods, and set the budget so that one of them may be disrupted:

yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
spec:
  replicas: 2
  selector:
    matchLabels:
      app.kubernetes.io/name: web
  template:
    metadata:
      labels:
        app.kubernetes.io/name: web
    spec:
      containers:
        - name: web
          image: registry.example.com/web:1.0.0
          securityContext:
            allowPrivilegeEscalation: false
            runAsNonRoot: true
            seccompProfile:
              type: RuntimeDefault
            capabilities:
              drop: ["ALL"]
          resources:
            requests:
              cpu: 50m
              memory: 64Mi
            limits:
              cpu: 100m
              memory: 128Mi
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: web
spec:
  maxUnavailable: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: web

The platform sets unhealthyPodEvictionPolicy: AlwaysAllow on every budget you create, so a pod that is not ready can always be moved. An accepted budget can still hold a node for a while: as long as one of its pods is not ready, the others stay where they are.

Each pod should be covered by one budget only. A pod covered by two budgets blocks node replacement, so two budgets in a namespace are accepted only when a matchLabels key appears in both with different values. matchExpressions do not count for this. If a running pod still ends up covered by two budgets, for example because both were created at the same moment, the platform keeps only the most recently created budget and deletes the others. It checks for this every ten minutes. The examples on this site all use app.kubernetes.io/name, so they can sit side by side in one namespace.

A budget is the supported way to protect a workload during maintenance. These are rejected:

  • A PodDisruptionBudget that does not select its pods with matchLabels, or whose matchLabels are empty (an empty selector covers every pod in the namespace).
  • A PodDisruptionBudget that sets minAvailable, sets no maxUnavailable, or sets maxUnavailable to zero (0 or 0%).
  • A PodDisruptionBudget that can cover the same pods as another budget in the namespace, as described above.
  • A PodDisruptionBudget whose selector uses more than 8 matchLabels, more than 4 matchExpressions, or more than 8 values in one expression.
  • A new PodDisruptionBudget in a namespace that already holds 20. Budgets that operators create for your databases count toward the limit too. A MariaDB or MaxScale whose budget cannot be created shows exceeded quota in its Ready condition; a Dragonfly shows no message, so check the count before adding one.
  • The disruption budget of a Dragonfly (spec.pdb) or of a MariaDB or MaxScale (spec.podDisruptionBudget), when it sets minAvailable, sets no maxUnavailable, or sets maxUnavailable to zero.
  • The karpenter.sh/do-not-disrupt annotation, on a pod or in the pod template of a Deployment, StatefulSet, Job or CronJob.
  • Tolerations for the taints that keep pods off the control-plane nodes and off nodes that are under maintenance, still starting up or under resource pressure: node-role.kubernetes.io/control-plane, node-role.kubernetes.io/master, node.kubernetes.io/unschedulable, karpenter.sh/disrupted, itsh.dev/rotation-avoid, karpenter.sh/unregistered, node.cloudprovider.kubernetes.io/uninitialized, node.cilium.io/agent-not-ready, node.kubernetes.io/network-unavailable, node.kubernetes.io/memory-pressure, node.kubernetes.io/disk-pressure and node.kubernetes.io/pid-pressure. node.kubernetes.io/not-ready and node.kubernetes.io/unreachable are permitted only with effect: NoExecute, the form Kubernetes adds to every pod on its own.

The last two rules also cover the resources an operator turns into pods for you: a PostgreSQL Cluster or Pooler, a Dragonfly, a MariaDB or MaxScale, a MariaDB Backup, Restore or SqlJob, and a ScaledJob. Their tolerations and pod metadata are checked when you apply them, not when the pods start. A nodeName in the pod template of a Pooler or ScaledJob is rejected at that point too.

What a rejection looks like ​

When a manifest breaks one of the rules, kubectl apply usually answers in this shape; the size bounds answer in a second one, shown under The API said no:

text
Error from server: error when creating "app.yaml": admission webhook "<webhook>" denied the request:

resource <Kind>/<your-namespace>/<name> was blocked due to the following policies

<policy>:
  <rule>: <the rule that fired, and why>

Two real examples are on Gateway API, for a hostname that is not yours, and on Databases, for exec into a PostgreSQL pod.

The exact wording depends on the rule. What matters is the difference from a syntax error: denied the request means your YAML is fine and a rule fired. There is nothing to fix in the manifest, you need a different approach, and the reason that follows tells you which rule it was.

What's next ​