Repositories
v1v
Published by: Kubernetes2Updated

Kubernetes v1 Workload resources are fundamental API objects that manage and orchestrate containerized applications within a cluster. These resources define how applications run, scale, and recover from failures. Key workload resources include Pods, Deployments, StatefulSets, DaemonSets, Jobs, and CronJobs, each designed to handle different workload patterns, ensuring reliability, scalability, and maintainability in Kubernetes environments.

v1
workload
|

Authentication

Add API authentication details

HEADERS
X-APIKEY
string
Send X-APIKEY in Header

Readme

User instructions for this resource

The DaemonSet template is designed to ensure that all (or some) nodes run a copy of a Pod. It uses a combination of facets and variables to allow for flexible configurations.

Variables

  • __DS_ID__: This global variable represents the identifier for the DaemonSet, used to access specific fields in the request values.

  • __SA_ID__: This variable is used specifically for the serviceAccountName field, allowing reference to a separate ServiceAccount resource.

Collection Breakdown

  1. Base
{
    "kind": "DaemonSet",
    "facets": ["master"],
    "metadata": "{{ __DS_ID__.metadata }}",
    "apiVersion": "apps/v1"
}

This section is always included (due to the master facet). It sets the kind, apiVersion, and metadata for the DaemonSet resource.

  1. Selector
{
    "spec": {
        "selector": "{{ __DS_ID__.spec.selector }}"
    },
    "facets": ["addon:spec"]
}

This section defines the selector for the DaemonSet, which determines which Pods are managed by this DaemonSet.

  1. Pod Template
{
    "spec": {
        "template": {
            "spec": {
                "containers": "{{ __DS_ID__.spec.template.spec.containers }}"
            },
            "metadata": "{{ __DS_ID__.spec.template.metadata }}"
        }
    },
    "facets": ["addon:spec", "addon:podtemplate"]
}

This section defines the pod template, including containers and metadata.

Design Decisions

  1. Modularity: The template is divided into multiple sections with separate facets, allowing users to include only the necessary parts of a DaemonSet definition.

  2. DaemonSet-Specific Features: The template includes DaemonSet-specific features like updateStrategy and revisionHistoryLimit, which are crucial for managing updates and rollbacks.

  3. Comprehensive Pod Specification: The template includes a detailed pod template specification, allowing for fine-grained control over the pods created by the DaemonSet.

  4. Node Scheduling: The template includes sections for nodeSelector, affinity, and tolerations, which are particularly important for DaemonSets to control which nodes the pods are scheduled on.

  5. Integration with Other Resources: The template allows for integration with other Kubernetes resources, such as ServiceAccounts, through dedicated variables.

Examples

Check Request Body tab section to play around with interactive examples.

Install(Example)

The Curl tab in the request section below provides the curl command for your resource.

curl -X POST "https://configfacets.com/apis/repos/kubernetes/workload-resources/v1/resources/collections/daemonset/exec?format=json" -d '{"facets":["master","addon:spec","addon:podtemplate"],"values":{"basic_daemonset":{"spec":{"selector":{"matchLabels":{"name":"fluentd-elasticsearch"}},"template":{"spec":{"volumes":[{"name":"varlog","hostPath":{"path":"/var/log"}},{"name":"varlibdockercontainers","hostPath":{"path":"/var/lib/docker/containers"}}],"containers":[{"name":"fluentd-elasticsearch","image":"quay.io/fluentd_elasticsearch/fluentd:v2.5.2","resources":{"limits":{"memory":"200Mi"},"requests":{"cpu":"100m","memory":"200Mi"}},"volumeMounts":[{"name":"varlog","mountPath":"/var/log"},{"name":"varlibdockercontainers","readOnly":true,"mountPath":"/var/lib/docker/containers"}]}],"terminationGracePeriodSeconds":30},"metadata":{"labels":{"name":"fluentd-elasticsearch"}}}},"metadata":{"name":"fluentd-elasticsearch","labels":{"k8s-app":"fluentd-logging"}}}},"globalvars":{"__DS_ID__":"basic_daemonset"}}' | kubectl apply -f -
POST/apis/repos/kubernetes/workload-resources/v1/resources/collections/daemonset/exec
REQUEST
QUERY-STRING PARAMETERS
format
string
No sources available.
API Server https://configfacets.com
API Key
Not set
RESPONSES
No content available.