Warning
This module will be removed from Salt in version 3009 in favor of the kubernetes Salt Extension.
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
New in version 2017.7.0.
Ensures that the named configmap is absent from the given namespace.
The name of the configmap
The namespace holding the configmap. The 'default' one is going to be used unless a different one is specified.
Ensures that the named configmap is present inside of the specified namespace with the given data. If the configmap exists it will be replaced.
The name of the configmap.
The namespace holding the configmap. The 'default' one is going to be used unless a different one is specified.
The dictionary holding the configmaps.
A file containing the data of the configmap in plain format.
Template engine to be used to render the source file.
Ensures that the named deployment is absent from the given namespace.
The name of the deployment
The name of the namespace
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.
The name of the deployment.
The namespace holding the deployment. The 'default' one is going to be used unless a different one is specified.
The metadata of the deployment object.
The spec of the deployment object.
A file containing the definition of the deployment (metadata and spec) in the official kubernetes format.
Template engine to be used to render the source file.
Ensures that the named namespace is absent.
The name of the namespace
Ensures that the named namespace is present.
The name of the namespace.
Ensures that the named label is absent from the node.
The name of the label
The name of the node
Ensures the label folder doesn't exist on the specified node.
The name of label folder
The name of the node
Ensures that the named label is set on the named node with the given value. If the label exists it will be replaced.
The name of the label.
Value of the label.
Node to change.
Ensures that the named pod is absent from the given namespace.
The name of the pod
The name of the namespace
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.
The name of the pod.
The namespace holding the pod. The 'default' one is going to be used unless a different one is specified.
The metadata of the pod object.
The spec of the pod object.
A file containing the definition of the pod (metadata and spec) in the official kubernetes format.
Template engine to be used to render the source file.
Ensures that the named secret is absent from the given namespace.
The name of the secret
The name of the namespace
Ensures that the named secret is present inside of the specified namespace with the given data. If the secret exists it will be replaced.
The name of the secret.
The namespace holding the secret. The 'default' one is going to be used unless a different one is specified.
The dictionary holding the secrets.
A file containing the data of the secret in plain format.
Template engine to be used to render the source file.
Ensures that the named service is absent from the given namespace.
The name of the service
The name of the namespace
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.
The name of the service.
The namespace holding the service. The 'default' one is going to be used unless a different one is specified.
The metadata of the service object.
The spec of the service object.
A file containing the definition of the service (metadata and spec) in the official kubernetes format.
Template engine to be used to render the source file.