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.kubeconfig: '/path/to/kubeconfig'
kubernetes.kubeconfig-data: '<base64 encoded kubeconfig content'
kubernetes.context: 'context'
|
These settings can be overridden by adding context and `kubeconfig or kubeconfig_data parameters when calling a function.
The data format for kubernetes.kubeconfig-data value is the content of kubeconfig base64 encoded in one line.
Only kubeconfig or kubeconfig-data should be provided. In case both are provided kubeconfig entry is preferred.
salt '*' kubernetes.nodes kubeconfig=/etc/salt/k8s/kubeconfig context=minikube
Changed in version 2019.2.0.
Warning
Configuration options changed in 2019.2.0. The following configuration options have been removed:
Please use now:
Return a list of kubernetes configmaps defined in the namespace
CLI Examples:
salt '*' kubernetes.configmaps salt '*' kubernetes.configmaps namespace=default
Creates the kubernetes configmap as defined by the user.
CLI Examples:
salt 'minion1' kubernetes.create_configmap settings default '{"example.conf": "# example file"}' salt 'minion2' kubernetes.create_configmap name=settings namespace=default data='{"example.conf": "# example file"}'
Creates the kubernetes deployment as defined by the user.
Creates a namespace with the specified name.
Creates the kubernetes deployment as defined by the user.
Creates the kubernetes secret as defined by the user.
CLI Examples:
salt 'minion1' kubernetes.create_secret passwords default '{"db": "letmein"}' salt 'minion2' kubernetes.create_secret name=passwords namespace=default data='{"db": "letmein"}'
Creates the kubernetes service as defined by the user.
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
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
Deletes the kubernetes namespace defined by name
CLI Examples:
salt '*' kubernetes.delete_namespace salt salt '*' kubernetes.delete_namespace name=salt
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
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
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
Return a list of kubernetes deployments defined in the namespace
CLI Examples:
salt '*' kubernetes.deployments salt '*' kubernetes.deployments namespace=default
Return the names of the available namespaces
CLI Examples:
salt '*' kubernetes.namespaces salt '*' kubernetes.namespaces kubeconfig=/etc/salt/k8s/kubeconfig context=minikube
Return the details of the node identified by the specified name
CLI Examples:
salt '*' kubernetes.node name='minikube'
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"
Return the labels of the node identified by the specified name
CLI Examples:
salt '*' kubernetes.node_labels name="minikube"
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"
Return the names of the nodes composing the kubernetes cluster
CLI Examples:
salt '*' kubernetes.nodes salt '*' kubernetes.nodes kubeconfig=/etc/salt/k8s/kubeconfig context=minikube
Checks connections with the kubernetes API server. Returns True if the connection can be established, False otherwise.
Return a list of kubernetes pods defined in the namespace
CLI Examples:
salt '*' kubernetes.pods salt '*' kubernetes.pods namespace=default
Replaces an existing configmap with a new one defined by name and namespace with the specified data.
CLI Examples:
salt 'minion1' kubernetes.replace_configmap settings default '{"example.conf": "# example file"}' salt 'minion2' kubernetes.replace_configmap name=settings namespace=default data='{"example.conf": "# example file"}'
Replaces an existing deployment with a new one defined by name and namespace, having the specificed metadata and spec.
Replaces an existing secret with a new one defined by name and namespace, having the specificed data.
CLI Examples:
salt 'minion1' kubernetes.replace_secret name=passwords data='{"db": "letmein"}' salt 'minion2' kubernetes.replace_secret name=passwords namespace=saltstack data='{"db": "passw0rd"}'
Replaces an existing service with a new one defined by name and namespace, having the specificed metadata and spec.
Return a list of kubernetes secrets defined in the namespace
CLI Examples:
salt '*' kubernetes.secrets salt '*' kubernetes.secrets namespace=default
Return a list of kubernetes services defined in the namespace
CLI Examples:
salt '*' kubernetes.services salt '*' kubernetes.services namespace=default
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
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
Return information for a given namespace defined by the specified name
CLI Examples:
salt '*' kubernetes.show_namespace kube-system
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
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
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
© 2019 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.kubernetesmod.html