Simple Log Service defines two Kubernetes CRDs—AliyunPipelineConfig and AliyunLogConfig—that let you manage Logtail configurations as CustomResources (CRs).
Overview
A CRD extends the Kubernetes API to define custom resource types. Each CR is an instance of a CRD. Extend the Kubernetes API with CustomResourceDefinitions.
To manage Logtail configurations with CRs, connect to your Kubernetes cluster, authenticate, and submit a YAML file to the kube-apiserver to create a CR.
If you create a Logtail configuration through a CR, always update it through the CR. Changes made in the SLS console do not sync back to the CR.
CRDs
SLS provides two CRDs for managing Logtail configurations in Kubernetes: AliyunPipelineConfig and AliyunLogConfig. The following table compares their capabilities.
AliyunPipelineConfig requires Logtail 0.5.1 or later.
|
CRD |
AliyunPipelineConfig (recommended) |
AliyunLogConfig |
|
ApiGroup |
telemetry.alibabacloud.com/v1alpha1 |
log.alibabacloud.com/v1alpha1 |
|
CRD resource name |
ClusterAliyunPipelineConfig |
AliyunLogConfig |
|
Scope |
Cluster |
Namespace |
|
Logtail configuration format |
Equivalent to LogtailPipelineConfig |
Equivalent to LogtailConfig |
|
Cross-region capability |
Supported |
Supported |
|
Cross-account capability |
Supported |
Supported |
|
Webhook-related parameter verification |
Supported |
Not supported |
|
Configuration conflict detection |
Supported |
Supported (Logtail 0.5+) |
|
Configuration difficulty |
Relatively low |
Relatively high |
|
Observability configuration |
The Status field includes error details, update time, the previously applied Logtail configuration, and when it was applied. |
The Status field contains the error code and error message. |
Troubleshoot 404 errors after a CRD is deleted
If creating or updating a Logtail configuration fails with no matches for kind "ClusterAliyunPipelineConfig" or the server could not find the requested resource, the ClusterAliyunPipelineConfig CRD may have been accidentally deleted.
Troubleshooting steps
-
Check whether the CRD still exists:
kubectl get crd | grep ClusterAliyunPipelineConfigIf no output is returned, the CRD has been deleted.
-
Reinstall LoongCollector to restore the CRD:
helm upgrade loongcollector loongcollector/loongcollector -n kube-system --reuse-valuesAlternatively, apply the CRD YAML directly:
kubectl apply -f crd.yaml -
Verify that the CRD has been restored:
kubectl get crd | grep ClusterAliyunPipelineConfig -
Verify that you can create Logtail configurations again:
kubectl apply -f your-pipeline-config.yaml
The CRD is managed by the crds directory of the LoongCollector Helm chart. Restarting loongcollector-operator does not recreate the CRD; you must restore it with helm upgrade or kubectl apply. Deleting the CRD also deletes all existing ClusterAliyunPipelineConfig resources.