NOTE: This module requires the proper pillar values set. See salt.modules.kubernetes for more information.
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
salt.states.kubernetes.
configmap_absent
(name, namespace='default', **kwargs)¶Ensures that the named configmap is absent from the given namespace.
salt.states.kubernetes.
configmap_present
(name, namespace='default', data=None, source=None, template=None, **kwargs)¶Ensures that the named configmap is present inside of the specified namespace with the given data. If the configmap exists it will be replaced.
salt.states.kubernetes.
deployment_absent
(name, namespace='default', **kwargs)¶Ensures that the named deployment is absent from the given namespace.
salt.states.kubernetes.
deployment_present
(name, namespace='default', metadata=None, spec=None, source='', template='', **kwargs)¶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.
salt.states.kubernetes.
namespace_absent
(name, **kwargs)¶Ensures that the named namespace is absent.
salt.states.kubernetes.
namespace_present
(name, **kwargs)¶Ensures that the named namespace is present.
salt.states.kubernetes.
node_label_absent
(name, node, **kwargs)¶Ensures that the named label is absent from the node.
salt.states.kubernetes.
node_label_folder_absent
(name, node, **kwargs)¶Ensures the label folder doesn’t exist on the specified node.
salt.states.kubernetes.
node_label_present
(name, node, value, **kwargs)¶Ensures that the named label is set on the named node with the given value. If the label exists it will be replaced.
salt.states.kubernetes.
pod_absent
(name, namespace='default', **kwargs)¶Ensures that the named pod is absent from the given namespace.
salt.states.kubernetes.
pod_present
(name, namespace='default', metadata=None, spec=None, source='', template='', **kwargs)¶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.
salt.states.kubernetes.
secret_absent
(name, namespace='default', **kwargs)¶Ensures that the named secret is absent from the given namespace.
salt.states.kubernetes.
secret_present
(name, namespace='default', data=None, source=None, template=None, **kwargs)¶Ensures that the named secret is present inside of the specified namespace with the given data. If the secret exists it will be replaced.
salt.states.kubernetes.
service_absent
(name, namespace='default', **kwargs)¶Ensures that the named service is absent from the given namespace.
salt.states.kubernetes.
service_present
(name, namespace='default', metadata=None, spec=None, source='', template='', **kwargs)¶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.