Fleet Assets in AnythingDB

AnythingDB provides the backbone for EdgeOps, just like it would in your applications. Each Asset in EdgeOps Fleet Management is represented in AnythingDB automatically, so you can interact with it.

In AnythingDB, for every Asset you provision, you will find a corresponding record in the Cluster category.

This section describes Actions defined on the Thing schema and how they allow interaction with the Edge.

Asset Thing Details in AnythingDB

Each Asset record in AnythingDB has a few preconfigured actions which you can use to control and configure your Asset remotely.

The following actions are defined automatically:

Action Description
Run statistics/metrics gathering Start and update the interval to receive the metrics.
Send kubectl Send kubectl commands from SmartWorks
Stop statistics/metrics gathering Stop the reception of metrics.
Send Kubernetes API Send a RESTful request to the Kubernetes API server running on the Cluster.
Note: The Management Service publishes metrics for the Nodes and Deployments of the Cluster at a regular interval (default: 30 seconds). This data is obtained from the Kubernetes Metrics Server which is installed by default in a K3s installation.

If an Action has a red settings icon and a greyed out Run button, then the Action needs to have parameters filled in before it can be executed. Click on the Settings icon to display the form.

When running an Action, the status updates for the Action are shown below the form. The final results of the Action are set up as an Event.

Action: Send kubectl

The Send kubectl form has three fields:

Name Description
CorrelationId Any alphanumeric text string specified by the user in order to match the resulting Event message to the originating Action.
Command Must be "kubectl".
Arguments Takes an array of strings based on the command line arguments for a kubectl command. This array can be entered using JSON notation.
Note: It is important that each argument is put in a new array entry. If there is a space in the complete command, then that means a new argument.

Useful kubectl commands translated into "command" and "arguments" parts:

Description Command Arguments
Get Nodes kubectl [ "get", "nodes"]
Get Nodes (wide) kubectl [ "get", "nodes", "-o", "wide"]
Top Node {node-name} kubectl [ "top", "node", "{node-name}"]
Get Services kubectl [ "get", "services"]
Get Config Maps kubectl [ "get", "configmaps"]
Get Deployments kubectl [ "get", "deployments"]
Restart Deployment {{deployment-name}} kubectl [ "rollout", "restart", "deployment", "{deployment-name}"]
Get Pods kubectl [ "get", "pods"]
Top Pod {pod-name} kubectl [ "top", "pod", "{pod-name}"]
Describe Pod {pod-name} kubectl [ "describe", "pod", "{pod-name}"]
Apply YAML {configuration.yaml} kubectl [ "apply", "-f", "{configuration.yaml}"]
Apply Multiple YAMLs kubectl [ "apply", "-f", "{configuration1.yaml}", "-f", "{configuration2.yaml}"]
Tip: Useful documentation for the kubectl CLI, including a kubectl cheat sheet can be found on the kubernetes website.

Action: Send kubernetes API

Available Endpoints

API calls to the Kubernetes API server at the edge cluster can be made using the Send Kubernetes API action.

The form fields show the following parameters: CorrelationId, RequestMethod, Href, and RequestBody. This is a RESTful API.

The CorrelationId is any alphanumeric text string specified by the user in order to match the resulting Event message to the originating Action.

Implemented kubernetes API endpoints are a subset of https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/

Currently Available
GET /api/v1/namespaces/{namespace}/pods/{name}/status
GET /api/v1/namespaces/{namespace}/services/{name}/status
GET /api/v1/namespaces/{namespace}/configmaps/{name}
GET /api/v1/namespaces/{namespace}/pods/{name}
GET /api/v1/namespaces/{namespace}/secrets/{name}
GET /api/v1/namespaces/{namespace}/serviceaccounts/{name}
GET /api/v1/namespaces/{namespace}/services/{name}
GET /api/v1/namespaces/{namespace}/configmaps
GET /api/v1/namespaces/{namespace}/pods
GET /api/v1/namespaces/{namespace}/secrets
GET /api/v1/namespaces/{namespace}/serviceaccounts
GET /api/v1/namespaces/{namespace}/services
GET /api/v1/namespaces/{name}/status
GET /api/v1/namespaces/{name}
GET /api/v1/nodes/{name}/status
GET /api/v1/nodes/{name}
PATCH /api/v1/namespaces/{namespace}/pods/{name}/status
PATCH /api/v1/namespaces/{namespace}/services/{name}/status
PATCH /api/v1/namespaces/{namespace}/configmaps/{name}
PATCH /api/v1/namespaces/{namespace}/pods/{name}
PATCH /api/v1/namespaces/{namespace}/secrets/{name}
PATCH /api/v1/namespaces/{namespace}/serviceaccounts/{name}
PATCH /api/v1/namespaces/{namespace}/services/{name}
PATCH /api/v1/namespaces/{name}
PATCH /api/v1/nodes/{name}/status
PATCH /api/v1/nodes/{name}
PUT /api/v1/namespaces/{namespace}/pods/{name}/status
PUT /api/v1/namespaces/{namespace}/services/{name}/status
PUT /api/v1/namespaces/{namespace}/configmaps/{name}
PUT /api/v1/namespaces/{namespace}/pods/{name}
PUT /api/v1/namespaces/{namespace}/secrets/{name}
PUT /api/v1/namespaces/{namespace}/serviceaccounts/{name}
PUT /api/v1/namespaces/{namespace}/services/{name}
PUT /api/v1/namespaces/{name}
PUT /api/v1/nodes/{name}/status
PUT /api/v1/nodes/{name}
DELETE /api/v1/namespaces/{namespace}/configmaps/{name}
DELETE /api/v1/namespaces/{namespace}/pods/{name}
DELETE /api/v1/namespaces/{namespace}/secrets/{name}
DELETE /api/v1/namespaces/{namespace}/serviceaccounts/{name}
DELETE /api/v1/namespaces/{namespace}/services/{name}
DELETE /api/v1/namespaces/{name}
DELETE /api/v1/nodes/{name}
POST /api/v1/namespaces/{namespace}/configmaps
POST /api/v1/namespaces/{namespace}/pods
POST /api/v1/namespaces/{namespace}/secrets
POST /api/v1/namespaces/{namespace}/serviceaccounts
POST /api/v1/namespaces/{namespace}/services
GET /api/v1/configmaps
GET /api/v1/namespaces
GET /api/v1/nodes
GET /api/v1/pods
GET /api/v1/secrets
GET /api/v1/serviceaccounts
GET /api/v1/services
GET /apis/apps/v1/namespaces/{namespace}/deployments/{name}/status
GET /apis/apps/v1/namespaces/{namespace}/deployments/{name}
GET /apis/apps/v1/namespaces/{namespace}/deployments
PATCH /apis/apps/v1/namespaces/{namespace}/deployments/{name}/status
PATCH /apis/apps/v1/namespaces/{namespace}/deployments/{name}
PUT /apis/apps/v1/namespaces/{namespace}/deployments/{name}/status
PUT /apis/apps/v1/namespaces/{namespace}/deployments/{name}
DELETE /apis/apps/v1/namespaces/{namespace}/deployments/{name}
POST /apis/apps/v1/namespaces/{namespace}/deployments
GET /apis/apps/v1/deployments
GET /apis/rbac.authorization.k8s.io/v1/clusterroles/{name}
GET /apis/rbac.authorization.k8s.io/v1/clusterrolebindings/{name}
GET /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles/{name}
GET /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings/{name}
GET /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles
GET /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings
PATCH /apis/rbac.authorization.k8s.io/v1/clusterroles/{name}
PATCH /apis/rbac.authorization.k8s.io/v1/clusterrolebindings/{name}
PATCH /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles/{name}
PATCH /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings/{name}
PUT /apis/rbac.authorization.k8s.io/v1/clusterroles/{name}
PUT /apis/rbac.authorization.k8s.io/v1/clusterrolebindings/{name}
PUT /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles/{name}
PUT /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings/{name}
DELETE /apis/rbac.authorization.k8s.io/v1/clusterroles/{name}
DELETE /apis/rbac.authorization.k8s.io/v1/clusterrolebindings/{name}
DELETE /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles/{name}
DELETE /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings/{name}
GET /apis/rbac.authorization.k8s.io/v1/clusterroles
GET /apis/rbac.authorization.k8s.io/v1/clusterrolebindings
GET /apis/rbac.authorization.k8s.io/v1/roles
GET /apis/rbac.authorization.k8s.io/v1/rolebindings
POST /apis/rbac.authorization.k8s.io/v1/clusterroles
POST /apis/rbac.authorization.k8s.io/v1/clusterrolebindings
POST /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/roles
POST /apis/rbac.authorization.k8s.io/v1/namespaces/{namespace}/rolebindings
K3s Custom Resource Definitions
GET /apis/helm.cattle.io/v1/namespaces/{namespace}/helmcharts
POST /apis/helm.cattle.io/v1/namespaces/{namespace}/helmcharts
GET /apis/helm.cattle.io/v1/namespaces/{namespace}/helmcharts/{name}
PUT /apis/helm.cattle.io/v1/namespaces/{namespace}/helmcharts/{name}
DELETE /apis/helm.cattle.io/v1/namespaces/{namespace}/helmcharts/{name}
GET /apis/helm.cattle.io/v1/namespaces/{namespace}/helmchartconfigs
POST /apis/helm.cattle.io/v1/namespaces/{namespace}/helmchartconfigs
GET /apis/helm.cattle.io/v1/namespaces/{namespace}/helmchartconfigs/{name}
PUT /apis/helm.cattle.io/v1/namespaces/{namespace}/helmchartconfigs/{name}
DELETE /apis/helm.cattle.io/v1/namespaces/{namespace}/helmchartconfigs/{name}
Custom
GET /apis/swx/v1/edge-apps
POST /apis/swx/v1/edge-apps
GET /apis/swx/v1/edge-apps/{edge-app-id}
PUT /apis/swx/v1/edge-apps/{edge-app-id}
DELETE /apis/swx/v1/edge-apps/{edge-app-id}
PUT /apis/swx/v1/apply
Request Body
The custom API endpoint is the equivalent of "kubectl apply" and accepts a URL as the request body or the actual yaml (string).
The other endpoints use JSON (stringified).
See the kubernetes reference documentation for details.