Applies a Kubernetes manifest to the specified cluster, either as a string, object, or file.
Input Schema
| Property | Type | Description | Required |
|---|---|---|---|
| namespaced | boolean | Whether the API is namespaced or not | |
| clusterName | string | The name of the cluster to apply this | |
| manifestPath | string | The path to the manifest file. | |
| manifestObject | object | The manifest to apply in the cluster. Must be an object | |
| manifestString | string | The manifest to apply in the cluster. Must be a string |
Output Schema
| Property | Type | Description | Required |
|---|---|---|---|
| type | any | - | |
| title | any | - | |
| description | any | - |
Usage Examples
Apply a ConfigMap using a manifest string
This applies an inline ConfigMap to a selected namespace in a chosen cluster. Use this when generating a small resource on the fly after fetching template files with fetch:template.
steps:
- id: fetch-base
action: fetch:template
input:
url: ./skeleton
targetPath: .
values:
name: ${{ parameters.name }}
namespace: ${{ parameters.namespace }}
- id: apply-configmap
action: cnoe:kubernetes:apply
input:
manifestString: |
apiVersion: v1
kind: ConfigMap
metadata:
name: ${{ parameters.name }}-config
namespace: ${{ parameters.namespace }}
labels:
app.kubernetes.io/name: ${{ parameters.name }}
app.kubernetes.io/part-of: ${{ parameters.name }}
data:
APP_NAME: "${{ parameters.name }}"
LOG_LEVEL: "info"
FEATURE_X_ENABLED: "true"
namespaced: true
clusterName: ${{ parameters.cluster }}Create a Namespace using manifestObject
This creates a cluster scoped Namespace using an object input. Use this when you want to ensure the namespace exists before applying namespaced resources.
steps:
- id: fetch-template
action: fetch:template
input:
url: ./skeleton
targetPath: .
values:
namespace: ${{ parameters.namespace }}
- id: apply-namespace
action: cnoe:kubernetes:apply
input:
manifestObject:
apiVersion: v1
kind: Namespace
metadata:
name: ${{ parameters.namespace }}
labels:
environment: prod
owner: platform-team
namespaced: false
clusterName: prod-us-east-1Apply a Deployment from a repository file path
This fetches manifests with fetch:template and applies a Deployment from a file path. Use this when your template materializes Kubernetes YAML files during scaffolding.
steps:
- id: fetch-manifests
action: fetch:template
input:
url: https://github.com/acme/templates/k8s-deployment
targetPath: .
values:
name: ${{ parameters.name }}
namespace: ${{ parameters.namespace }}
image: ghcr.io/acme/${{ parameters.name }}:${{ parameters.imageTag }}
- id: apply-deployment
action: cnoe:kubernetes:apply
input:
manifestPath: k8s/deployment.yaml
namespaced: true
clusterName: ${{ parameters.cluster }}Apply multiple RBAC resources in one manifest string
This applies a ServiceAccount, Role, and RoleBinding defined in a single multi document manifest string. Use this to bootstrap namespace RBAC in one step after fetching files with fetch:template.
steps:
- id: fetch-rbac-templates
action: fetch:template
input:
url: ./skeleton
targetPath: .
values:
namespace: ${{ parameters.namespace }}
- id: apply-rbac
action: cnoe:kubernetes:apply
input:
manifestString: |
apiVersion: v1
kind: ServiceAccount
metadata:
name: release-bot
namespace: ${{ parameters.namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: release-bot
namespace: ${{ parameters.namespace }}
rules:
- apiGroups: [""]
resources: ["pods","pods/log"]
verbs: ["get","list","watch"]
- apiGroups: ["batch"]
resources: ["jobs"]
verbs: ["create","get","list","watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: release-bot
namespace: ${{ parameters.namespace }}
subjects:
- kind: ServiceAccount
name: release-bot
namespace: ${{ parameters.namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: release-bot
namespaced: true
clusterName: staging-01Apply a ClusterRole from file without specifying cluster
This applies a cluster scoped ClusterRole from a file path and relies on the default cluster context. Use this when you want to apply global RBAC without passing a cluster name explicitly after fetching files with fetch:template.
steps:
- id: fetch-rbac
action: fetch:template
input:
url: https://github.com/acme/templates/k8s-rbac
targetPath: .
values:
app: ${{ parameters.name }}
- id: apply-clusterrole
action: cnoe:kubernetes:apply
input:
manifestPath: rbac/clusterrole.yaml
namespaced: false