containerd/containerd · error

resource is unreasonably small (< 1kbit)

Error message

resource is unreasonably small (< 1kbit)

What it means

Kata/CRI bandwidth annotation validation (inherited from kubernetes pkg/util/bandwidth) rejects a bandwidth resource quantity smaller than 1k (1000 bits per second) because TC shaping with such a tiny rate is meaningless. The check runs when extracting ingress/egress values from pod annotations.

Source

Thrown at internal/cri/bandwidth/utils.go:47

See the License for the specific language governing permissions and
limitations under the License.
*/

// Package bandwidth provides utilities for bandwidth shaping
package bandwidth

import (
	"fmt"

	"k8s.io/apimachinery/pkg/api/resource"
)

var minRsrc = resource.MustParse("1k")
var maxRsrc = resource.MustParse("1P")

func validateBandwidthIsReasonable(rsrc *resource.Quantity) error {
	if rsrc.Value() < minRsrc.Value() {
		return fmt.Errorf("resource is unreasonably small (< 1kbit)")
	}
	if rsrc.Value() > maxRsrc.Value() {
		return fmt.Errorf("resource is unreasonably large (> 1Pbit)")
	}
	return nil
}

// ExtractPodBandwidthResources extracts the ingress and egress from the given pod annotations
func ExtractPodBandwidthResources(podAnnotations map[string]string) (ingress, egress *resource.Quantity, err error) {
	if podAnnotations == nil {
		return nil, nil, nil
	}
	str, found := podAnnotations["kubernetes.io/ingress-bandwidth"]
	if found {
		ingressValue, err := resource.ParseQuantity(str)
		if err != nil {
			return nil, nil, err
		}

View on GitHub (pinned to 4246446a2b)

Solutions

  1. Set the annotation to a value >= 1k, e.g. "1M" or "10M".
  2. Use proper unit suffixes (k/M/G) in the bandwidth annotations.
  3. Remove the bandwidth annotation if throttling is not actually needed.

Example fix

// before
annotations:
  kubernetes.io/ingress-bandwidth: "100"
// after
annotations:
  kubernetes.io/ingress-bandwidth: "100M"
Defensive patterns

Strategy: validation

Validate before calling

func validBandwidth(v string) bool {
    q, err := resource.ParseQuantity(v)
    if err != nil { return false }
    min := resource.MustParse("1k")
    max := resource.MustParse("1P")
    return q.Value() >= min.Value() && q.Value() <= max.Value()
}
// use: if !validBandwidth(pod.Annotations["kubernetes.io/ingress-bandwidth"]) { reject pod / drop annotation }

Type guard

func isReasonableBandwidth(q *resource.Quantity) bool {
    return q != nil && q.Value() >= resource.MustParse("1k").Value() && q.Value() <= resource.MustParse("1P").Value()
}

Prevention

When it happens

Trigger: A pod annotation like kubernetes.io/ingress-bandwidth or kubernetes.io/egress-bandwidth is set to a quantity whose value() is below minRsrc = resource.MustParse("1k") (e.g. "100" or "1b").

Common situations: Typo in bandwidth annotation units (e.g. "100" instead of "100M"), testing with tiny values, copying annotations with stripped unit suffixes.

Related errors


AI-assisted analysis of containerd/containerd@4246446a2b (2026-09-02). Data as JSON: /api/errors/8239d141b5e578b0. Report an issue: GitHub.