Kubernetes
The Kubernetes component lookup fetches kubernetes resources to be used as components.
kube-configmap-components.yaml---
apiVersion: canaries.flanksource.com/v1
kind: Topology
metadata:
name: kubernetes-configs
spec:
type: Config
icon: kubernetes
schedule: "@every 5m"
components:
- name: configs
icon: server
type: ConfigMap
lookup:
kubernetes:
- kind: ConfigMap
display:
expr: |
dyn(results).map(c, {
'name': c.Object.metadata.name,
'type': 'ConfigMap',
}).toJSON()
Field | Description | Scheme | Required |
---|---|---|---|
display | Template to display query results in text (overrides default bar format for UI) | Template | |
ignore | Ignore the specified resources from the fetched resources. Can be a glob pattern. | []string | |
kind | Specifies the kind of Kubernetes object for interaction | string | Yes |
labels | Labels for the check | string | |
namespace | Specifies namespace for Kubernetes object | ResourceSelector | |
ready | Boolean value of true or false to query and display resources based on availability | bool | |
resource | Queries resources related to specified Kubernetes object | ResourceSelector | |
transform | Template to transform results to | Template |
ResourceSelector
Field | Description | Scheme | Required |
---|---|---|---|
name | Name of Kubernetes resource | string | |
labelSelector | Select Kubernetes resource based on label. e.g. app, canary. | string | |
fieldSelector | Select Kubernetes resource based on the value of specified resource field | string |
Results
The results
variable in the template is itself a list of all the kubernetes resources.
Remote clusters
A single canary-checker instance can connect to any number of remote clusters via custom kubeconfig. Either the kubeconfig itself or the path to the kubeconfig can be provided.
From kubernetes secret
remote-cluster.yaml---
apiVersion: canaries.flanksource.com/v1
kind: Topology
metadata:
name: kubernetes-configs
spec:
type: Config
icon: kubernetes
schedule: "@every 5m"
components:
- name: configs
icon: server
type: ConfigMap
lookup:
kubernetes:
- kind: ConfigMap
display:
expr: |
dyn(results).map(c, {
'name': c.Object.metadata.name,
'type': 'ConfigMap',
}).toJSON()
kubeconfig:
valueFrom:
secretKeyRef:
name: aws-kubeconfig
key: kubeconfig
Kubeconfig inline
remote-cluster.yamlapiVersion: canaries.flanksource.com/v1
kind: Topology
metadata:
name: kubernetes-configs
spec:
type: Config
icon: kubernetes
schedule: "@every 5m"
components:
- name: configs
icon: server
type: ConfigMap
lookup:
kubernetes:
- kind: ConfigMap
display:
expr: |
dyn(results).map(c, {
'name': c.Object.metadata.name,
'type': 'ConfigMap',
}).toJSON()
kubeconfig:
value: |
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: xxxxx
server: https://xxxxx.sk1.eu-west-1.eks.amazonaws.com
name: arn:aws:eks:eu-west-1:765618022540:cluster/aws-cluster
contexts:
- context:
cluster: arn:aws:eks:eu-west-1:765618022540:cluster/aws-cluster
namespace: mission-control
user: arn:aws:eks:eu-west-1:765618022540:cluster/aws-cluster
name: arn:aws:eks:eu-west-1:765618022540:cluster/aws-cluster
current-context: arn:aws:eks:eu-west-1:765618022540:cluster/aws-cluster
kind: Config
preferences: {}
users:
- name: arn:aws:eks:eu-west-1:765618022540:cluster/aws-cluster
user:
exec:
....
From local filesystem
remote-cluster.yamlapiVersion: canaries.flanksource.com/v1
kind: Topology
metadata:
name: kubernetes-configs
spec:
type: Config
icon: kubernetes
schedule: "@every 5m"
components:
- name: configs
icon: server
type: ConfigMap
lookup:
kubernetes:
- kind: ConfigMap
display:
expr: |
dyn(results).map(c, {
'name': c.name,
'type': 'ConfigMap',
}).toJSON()
kubeconfig:
value: /root/.kube/aws-kubeconfig