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. |
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. |
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}"] |
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}
- 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}
- 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}
- 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).