Resource Type: kubectl_apply

Defined in:
lib/puppet/type/kubectl_apply.rb
Providers:
file
kubectl

Overview

Example:

To encode the bootstrap token “tokenid.tokensecret” into a Kubernetes secret;

$tokenid = 'tokenid'
$tokensecret = 'tokensecret'
kubectl_apply { "bootstrap-token-${tokenid}":
  namespace   => 'kube-system',
  kubeconfig  => '/root/.kube/config',

  api_version => 'v1,
  kind        => 'Secret',

  content     => {
    type => 'bootstrap.kubernetes.io/token',
    data => {
      'token-id'                       => Binary.new($tokenid, '%s'),
      'token-secret'                   => Binary.new($tokensecret, '%s'),
      'usage-bootstrap-authentication' => 'true',
    },
  },
}

Properties

  • ensure (defaults to: present)

    Whether the described resource should be present or absent (default: present)

    Supported values:
    • present
    • absent

Parameters

  • api_version

    The apiVersion of the resource

  • content (defaults to: {})

    The resource content, will be used as the base for the resulting Kubernetes resource

  • file

    The local file for the resource

  • kind

    The kind of the resource

  • kubeconfig

    The kubeconfig file to use for handling the resource

  • name (namevar)

    The Puppet name of the instance

  • namespace

    The namespace the resource is contained in

  • provider

    The specific backend to use for this ‘kubectl_apply` resource. You will seldom need to specify this — Puppet will usually discover the appropriate provider for your platform.

  • recreate (defaults to: false)

    Should updates be done by removal and recreation

    Supported values:
    • true
    • false
    • yes
    • no
  • resource_name

    The name of the resource

  • show_diff (defaults to: false)

    Whether to display the difference when the resource changes

    Supported values:
    • true
    • false
    • yes
    • no
  • update (defaults to: true)

    Whether to update the resource if the content differs

    Supported values:
    • true
    • false
    • yes
    • no