kubernetes
¶
Manage kubernetes resources as salt states¶
NOTE: This module requires the proper pillar values set. See salt.modules.kubernetesmod for more information.
Warning
Configuration options will change in 2019.2.0.
The kubernetes module is used to manage different kubernetes resources.
my-nginx:
kubernetes.deployment_present:
- namespace: default
metadata:
app: frontend
spec:
replicas: 1
template:
metadata:
labels:
run: my-nginx
spec:
containers:
- name: my-nginx
image: nginx
ports:
- containerPort: 80
my-mariadb:
kubernetes.deployment_absent:
- namespace: default
# kubernetes deployment as specified inside of
# a file containing the definition of the the
# deployment using the official kubernetes format
redis-master-deployment:
kubernetes.deployment_present:
- name: redis-master
- source: salt://k8s/redis-master-deployment.yml
require:
- pip: kubernetes-python-module
# kubernetes service as specified inside of
# a file containing the definition of the the
# service using the official kubernetes format
redis-master-service:
kubernetes.service_present:
- name: redis-master
- source: salt://k8s/redis-master-service.yml
require:
- kubernetes.deployment_present: redis-master
# kubernetes deployment as specified inside of
# a file containing the definition of the the
# deployment using the official kubernetes format
# plus some jinja directives
nginx-source-template:
kubernetes.deployment_present:
- source: salt://k8s/nginx.yml.jinja
- template: jinja
require:
- pip: kubernetes-python-module
# Kubernetes secret
k8s-secret:
kubernetes.secret_present:
- name: top-secret
data:
key1: value1
key2: value2
key3: value3
Added in version 2017.7.0.
- saltext.kubernetes.states.kubernetesmod.__virtual__()[source]¶
Only load if the kubernetes module is available in __salt__
- saltext.kubernetes.states.kubernetesmod.deployment_absent(name, namespace='default', **kwargs)[source]¶
Ensures that the named deployment is absent from the given namespace.
- name
The name of the deployment
- namespace
The name of the namespace
- saltext.kubernetes.states.kubernetesmod.deployment_present(name, namespace='default', metadata=None, spec=None, source='', template='', **kwargs)[source]¶
Ensures that the named deployment is present inside of the specified namespace with the given metadata and spec. If the deployment exists it will be replaced.
- name
The name of the deployment.
- namespace
The namespace holding the deployment. The ‘default’ one is going to be used unless a different one is specified.
- metadata
The metadata of the deployment object.
- spec
The spec of the deployment object.
- source
A file containing the definition of the deployment (metadata and spec) in the official kubernetes format.
- template
Template engine to be used to render the source file.
- saltext.kubernetes.states.kubernetesmod.service_present(name, namespace='default', metadata=None, spec=None, source='', template='', **kwargs)[source]¶
Ensures that the named service is present inside of the specified namespace with the given metadata and spec. If the deployment exists it will be replaced.
- name
The name of the service.
- namespace
The namespace holding the service. The ‘default’ one is going to be used unless a different one is specified.
- metadata
The metadata of the service object.
- spec
The spec of the service object.
- source
A file containing the definition of the service (metadata and spec) in the official kubernetes format.
- template
Template engine to be used to render the source file.
- saltext.kubernetes.states.kubernetesmod.service_absent(name, namespace='default', **kwargs)[source]¶
Ensures that the named service is absent from the given namespace.
- name
The name of the service
- namespace
The name of the namespace
- saltext.kubernetes.states.kubernetesmod.namespace_absent(name, **kwargs)[source]¶
Ensures that the named namespace is absent.
- name
The name of the namespace
- saltext.kubernetes.states.kubernetesmod.namespace_present(name, **kwargs)[source]¶
Ensures that the named namespace is present.
- name
The name of the namespace.
- saltext.kubernetes.states.kubernetesmod.secret_absent(name, namespace='default', **kwargs)[source]¶
Ensures that the named secret is absent from the given namespace.
- name
The name of the secret
- namespace
The name of the namespace
- saltext.kubernetes.states.kubernetesmod.secret_present(name, namespace='default', data=None, source=None, template=None, **kwargs)[source]¶
Ensures that the named secret is present inside of the specified namespace with the given data. If the secret exists it will be replaced.
- name
The name of the secret.
- namespace
The namespace holding the secret. The ‘default’ one is going to be used unless a different one is specified.
- data
The dictionary holding the secrets.
- source
A file containing the data of the secret in plain format.
- template
Template engine to be used to render the source file.
- saltext.kubernetes.states.kubernetesmod.configmap_absent(name, namespace='default', **kwargs)[source]¶
Ensures that the named configmap is absent from the given namespace.
- name
The name of the configmap
- namespace
The namespace holding the configmap. The ‘default’ one is going to be used unless a different one is specified.
- saltext.kubernetes.states.kubernetesmod.configmap_present(name, namespace='default', data=None, source=None, template=None, **kwargs)[source]¶
Ensures that the named configmap is present inside of the specified namespace with the given data. If the configmap exists it will be replaced.
- name
The name of the configmap.
- namespace
The namespace holding the configmap. The ‘default’ one is going to be used unless a different one is specified.
- data
The dictionary holding the configmaps.
- source
A file containing the data of the configmap in plain format.
- template
Template engine to be used to render the source file.
- saltext.kubernetes.states.kubernetesmod.pod_absent(name, namespace='default', **kwargs)[source]¶
Ensures that the named pod is absent from the given namespace.
- name
The name of the pod
- namespace
The name of the namespace
- saltext.kubernetes.states.kubernetesmod.pod_present(name, namespace='default', metadata=None, spec=None, source='', template='', **kwargs)[source]¶
Ensures that the named pod is present inside of the specified namespace with the given metadata and spec. If the pod exists it will be replaced.
- name
The name of the pod.
- namespace
The namespace holding the pod. The ‘default’ one is going to be used unless a different one is specified.
- metadata
The metadata of the pod object.
- spec
The spec of the pod object.
- source
A file containing the definition of the pod (metadata and spec) in the official kubernetes format.
- template
Template engine to be used to render the source file.
- saltext.kubernetes.states.kubernetesmod.node_label_absent(name, node, **kwargs)[source]¶
Ensures that the named label is absent from the node.
- name
The name of the label
- node
The name of the node