Kubernetes
Deploy and manage Kubernetes objects against any cluster reachable from the machine running the deployment.
Community Maintained
| Version | 0.0.1 |
| Artifact | br:ghcr.io/anthony-c-martin/bicep-ext-kubernetes:0.0.1 |
| Source | github.com/anthony-c-martin/bicep-ext-kubernetes |
| Publisher | anthony-c-martin |
| Licence | MIT |
| Category | Containers |
Installation
Register the extension in bicepconfig.json:
{
"experimentalFeaturesEnabled": {
"localDeploy": true,
"ociEnabled": true
},
"implicitExtensions": [],
"extensions": {
"kubernetes": "br:ghcr.io/anthony-c-martin/bicep-ext-kubernetes:0.0.1"
}
}
Then reference it from your Bicep file:
extension kubernetes
Configuration
Configuration is supplied using extension kubernetes with { ... }.
| Property | Type | Attributes | Description |
|---|---|---|---|
kubeConfig | string | Required, Sensitive | The Kubernetes configuration file, base-64 encoded. |
namespace | string | Required | The default Kubernetes namespace to deploy resources to. |
context | string | The kubeconfig context to use. If not set, the current context within the kubeconfig file is used. |
Connecting to a cluster
The extension needs a kubeconfig file, base-64 encoded, and the namespace to deploy into:
@secure()
param kubeConfig string
extension kubernetes with {
kubeConfig: kubeConfig
namespace: 'default'
}
Encode an existing kubeconfig with:
base64 -i ~/.kube/config
main.bicepparam
using 'main.bicep'
param kubeConfig = readEnvironmentVariable('KUBECONFIG_BASE64')
A kubeconfig can define several clusters. Set context to choose one; when it is
omitted the file's current context is used:
extension kubernetes with {
kubeConfig: kubeConfig
namespace: 'default'
context: 'staging-cluster'
}
Example
targetScope = 'local'
@secure()
param kubeConfig string
extension kubernetes with {
kubeConfig: kubeConfig
namespace: 'default'
}
resource deployment 'apps/Deployment@v1' = {
metadata: {
name: 'web'
}
spec: {
replicas: 2
selector: {
matchLabels: {
app: 'web'
}
}
template: {
metadata: {
labels: {
app: 'web'
}
}
spec: {
containers: [
{
name: 'web'
image: 'nginx:1.27'
}
]
}
}
}
}
Notes
- Resource types follow the Kubernetes group, kind and version convention, such
as
apps/Deployment@v1orcore/Pod@v1. Alpha and beta API versions are exposed alongside stable ones, for exampleadmissionregistration.k8s.io/ValidatingAdmissionPolicy@v1beta1. - Every object requires
metadata.name. Setmetadata.namespaceto override the extension's default namespace for an individual resource. - Properties marked read-only, such as
apiVersion,kindandstatus, are populated by the cluster and cannot be set. - The machine running the deployment needs network access to the cluster's API server.
Samples
2 example Bicep files are available under Samples.
Resource types
This extension exposes 81 resource types, documented under Reference.
Reference generated from ghcr.io/anthony-c-martin/bicep-ext-kubernetes:0.0.1 on 2026-08-23.