k8s_node resource
Use the k8s_node Chef InSpec audit resource to test the configuration of the K8s node.
Syntax
describe k8s_node(name: "NAME") do
#...
end
Parameters
name- Node name.
Properties
uid- UID of the node.
kind- Resource type of the node.
resource_version- Resource version of the node.
labels- Labels attached to the node.
annotations- Annotations of the node.
Examples
Test to verify that the node with the specified name exists:
describe k8s_node(name: "NODE_NAME") do
it { should exist }
end
Matchers
For a full list of available matchers, see our Universal Matchers page.have_label:
The have_label matcher verifies if the specified key and value are present in the node labels.
it { should have_label('foo', 'bar') }
have_annotation:
The have_annotation matcher verifies if the specified key and value are present in the node annotations.
it { should have_annotation('foo', 'bar') }