Module for handling kubernetes calls.
optdepends: |
|
---|---|
configuration: | The k8s API settings are provided either in a pillar, in the minion's config file, or in master's config file: kubernetes.user: admin
kubernetes.password: verybadpass
kubernetes.api_url: 'http://127.0.0.1:8080'
kubernetes.certificate-authority-data: '...'
kubernetes.client-certificate-data: '....n
kubernetes.client-key-data: '...'
kubernetes.certificate-authority-file: '/path/to/ca.crt'
kubernetes.client-certificate-file: '/path/to/client.crt'
kubernetes.client-key-file: '/path/to/client.key'
|
These settings can be also overridden by adding api_url, api_user, api_password, api_certificate_authority_file, api_client_certificate_file or api_client_key_file parameters when calling a function:
The data format for kubernetes.*-data values is the same as provided in kubeconfig. It's base64 encoded certificates/keys in one line.
For an item only one field should be provided. Either a data or a file entry. In case both are provided the file entry is preferred.
salt '*' kubernetes.nodes api_url=http://k8s-api-server:port api_user=myuser api_password=pass
Warning
Configuration options will change in Flourine. All options above will be replaced by:
salt.modules.kubernetes.
configmaps
(namespace='default', **kwargs)¶Return a list of kubernetes configmaps defined in the namespace
CLI Examples:
salt '*' kubernetes.configmaps
salt '*' kubernetes.configmaps namespace=default
salt.modules.kubernetes.
create_configmap
(name, namespace, data, source, template, saltenv, **kwargs)¶Creates the kubernetes configmap as defined by the user.
salt.modules.kubernetes.
create_deployment
(name, namespace, metadata, spec, source, template, saltenv, **kwargs)¶Creates the kubernetes deployment as defined by the user.
salt.modules.kubernetes.
create_namespace
(name, **kwargs)¶Creates a namespace with the specified name.
salt.modules.kubernetes.
create_pod
(name, namespace, metadata, spec, source, template, saltenv, **kwargs)¶Creates the kubernetes deployment as defined by the user.
salt.modules.kubernetes.
create_secret
(name, namespace, data, source, template, saltenv, **kwargs)¶Creates the kubernetes secret as defined by the user.
salt.modules.kubernetes.
create_service
(name, namespace, metadata, spec, source, template, saltenv, **kwargs)¶Creates the kubernetes service as defined by the user.
salt.modules.kubernetes.
delete_configmap
(name, namespace='default', **kwargs)¶Deletes the kubernetes configmap defined by name and namespace
CLI Examples:
salt '*' kubernetes.delete_configmap settings default
salt '*' kubernetes.delete_configmap name=settings namespace=default
salt.modules.kubernetes.
delete_deployment
(name, namespace='default', **kwargs)¶Deletes the kubernetes deployment defined by name and namespace
CLI Examples:
salt '*' kubernetes.delete_deployment my-nginx
salt '*' kubernetes.delete_deployment name=my-nginx namespace=default
salt.modules.kubernetes.
delete_namespace
(name, **kwargs)¶Deletes the kubernetes namespace defined by name
CLI Examples:
salt '*' kubernetes.delete_namespace salt
salt '*' kubernetes.delete_namespace name=salt
salt.modules.kubernetes.
delete_pod
(name, namespace='default', **kwargs)¶Deletes the kubernetes pod defined by name and namespace
CLI Examples:
salt '*' kubernetes.delete_pod guestbook-708336848-5nl8c default
salt '*' kubernetes.delete_pod name=guestbook-708336848-5nl8c namespace=default
salt.modules.kubernetes.
delete_secret
(name, namespace='default', **kwargs)¶Deletes the kubernetes secret defined by name and namespace
CLI Examples:
salt '*' kubernetes.delete_secret confidential default
salt '*' kubernetes.delete_secret name=confidential namespace=default
salt.modules.kubernetes.
delete_service
(name, namespace='default', **kwargs)¶Deletes the kubernetes service defined by name and namespace
CLI Examples:
salt '*' kubernetes.delete_service my-nginx default
salt '*' kubernetes.delete_service name=my-nginx namespace=default
salt.modules.kubernetes.
deployments
(namespace='default', **kwargs)¶Return a list of kubernetes deployments defined in the namespace
CLI Examples:
salt '*' kubernetes.deployments
salt '*' kubernetes.deployments namespace=default
salt.modules.kubernetes.
namespaces
(**kwargs)¶Return the names of the available namespaces
CLI Examples:
salt '*' kubernetes.namespaces
salt '*' kubernetes.namespaces api_url=http://myhost:port api_user=my-user
salt.modules.kubernetes.
node
(name, **kwargs)¶Return the details of the node identified by the specified name
CLI Examples:
salt '*' kubernetes.node name='minikube'
salt.modules.kubernetes.
node_add_label
(node_name, label_name, label_value, **kwargs)¶Set the value of the label identified by label_name to label_value on the node identified by the name node_name. Creates the lable if not present.
CLI Examples:
salt '*' kubernetes.node_add_label node_name="minikube" label_name="foo" label_value="bar"
salt.modules.kubernetes.
node_labels
(name, **kwargs)¶Return the labels of the node identified by the specified name
CLI Examples:
salt '*' kubernetes.node_labels name="minikube"
salt.modules.kubernetes.
node_remove_label
(node_name, label_name, **kwargs)¶Removes the label identified by label_name from the node identified by the name node_name.
CLI Examples:
salt '*' kubernetes.node_remove_label node_name="minikube" label_name="foo"
salt.modules.kubernetes.
nodes
(**kwargs)¶Return the names of the nodes composing the kubernetes cluster
CLI Examples:
salt '*' kubernetes.nodes
salt '*' kubernetes.nodes api_url=http://myhost:port api_user=my-user
salt.modules.kubernetes.
ping
(**kwargs)¶Checks connections with the kubernetes API server. Returns True if the connection can be established, False otherwise.
salt.modules.kubernetes.
pods
(namespace='default', **kwargs)¶Return a list of kubernetes pods defined in the namespace
CLI Examples:
salt '*' kubernetes.pods
salt '*' kubernetes.pods namespace=default
salt.modules.kubernetes.
replace_configmap
(name, data, source, template, saltenv, namespace='default', **kwargs)¶Replaces an existing configmap with a new one defined by name and namespace, having the specificed data.
salt.modules.kubernetes.
replace_deployment
(name, metadata, spec, source, template, saltenv, namespace='default', **kwargs)¶Replaces an existing deployment with a new one defined by name and namespace, having the specificed metadata and spec.
salt.modules.kubernetes.
replace_secret
(name, data, source, template, saltenv, namespace='default', **kwargs)¶Replaces an existing secret with a new one defined by name and namespace, having the specificed data.
salt.modules.kubernetes.
replace_service
(name, metadata, spec, source, template, old_service, saltenv, namespace='default', **kwargs)¶Replaces an existing service with a new one defined by name and namespace, having the specificed metadata and spec.
salt.modules.kubernetes.
secrets
(namespace='default', **kwargs)¶Return a list of kubernetes secrets defined in the namespace
CLI Examples:
salt '*' kubernetes.secrets
salt '*' kubernetes.secrets namespace=default
salt.modules.kubernetes.
services
(namespace='default', **kwargs)¶Return a list of kubernetes services defined in the namespace
CLI Examples:
salt '*' kubernetes.services
salt '*' kubernetes.services namespace=default
salt.modules.kubernetes.
show_configmap
(name, namespace='default', **kwargs)¶Return the kubernetes configmap defined by name and namespace.
CLI Examples:
salt '*' kubernetes.show_configmap game-config default
salt '*' kubernetes.show_configmap name=game-config namespace=default
salt.modules.kubernetes.
show_deployment
(name, namespace='default', **kwargs)¶Return the kubernetes deployment defined by name and namespace
CLI Examples:
salt '*' kubernetes.show_deployment my-nginx default
salt '*' kubernetes.show_deployment name=my-nginx namespace=default
salt.modules.kubernetes.
show_namespace
(name, **kwargs)¶Return information for a given namespace defined by the specified name
CLI Examples:
salt '*' kubernetes.show_namespace kube-system
salt.modules.kubernetes.
show_pod
(name, namespace='default', **kwargs)¶Return POD information for a given pod name defined in the namespace
CLI Examples:
salt '*' kubernetes.show_pod guestbook-708336848-fqr2x
salt '*' kubernetes.show_pod guestbook-708336848-fqr2x namespace=default
salt.modules.kubernetes.
show_secret
(name, namespace='default', decode=False, **kwargs)¶Return the kubernetes secret defined by name and namespace. The secrets can be decoded if specified by the user. Warning: this has security implications.
CLI Examples:
salt '*' kubernetes.show_secret confidential default
salt '*' kubernetes.show_secret name=confidential namespace=default
salt '*' kubernetes.show_secret name=confidential decode=True
salt.modules.kubernetes.
show_service
(name, namespace='default', **kwargs)¶Return the kubernetes service defined by name and namespace
CLI Examples:
salt '*' kubernetes.show_service my-nginx default
salt '*' kubernetes.show_service name=my-nginx namespace=default