Collector for Kubernetes commands reference π
The following table lists all the commands and their usage in context of the Splunk Distribution of the OpenTelemetry Collector for Kubernetes. Select a command for a more detailed description and syntax examples.
Command |
Usage |
---|---|
Delete the Splunk Distribution of OpenTelemetry Collector Helm chart repository |
|
Deploy the Splunk Distribution of OpenTelemetry Collector Helm chart repository |
|
Add the Splunk Distribution of OpenTelemetry Collector Helm chart repository |
|
Update the Splunk Distribution of OpenTelemetry Collector Helm chart repository |
|
Check the collector logs on the host |
|
Modify Kubernetes configurations |
|
Create a Kubernetes resource |
|
Delete a Kubernetes resource |
|
Check Kubernetes system configurations |
|
Edit a Kubernetes resource. Use this command for initial configuration, effective configuration, and checking the status of the collector. |
|
Execute a command in a Kubernetes container |
|
Display one or many resources running on Kubernetes |
|
Check logs in a Kubernetes container |
|
Restart the collector on the host |
|
Start the collector on the host |
|
Check the collector status on the host (Linux only) |
|
Stop the collector on the host |
helm delete π
Description π
Delete the Splunk Distribution of OpenTelemetry Collector Helm chart repository.
Syntax π
helm delete splunk-otel-collector
helm install π
Description π
Deploy the Splunk Distribution of OpenTelemetry Collector Helm chart repository.
Syntax π
helm install splunk-otel-collector \
--set="splunkRealm=$REALM" \
--set="splunkAccessToken=$ACCESS_TOKEN" \
--set="clusterName=<MY-CLUSTER>" \
--set="logsEnabled=false" \
--set="environment=$<MY-ENV>" \
splunk-otel-collector-chart/splunk-otel-collector \
-f ~/workshop/k3s/otel-collector.yaml
You can also set Helm values as arguments using a YAML file. For example, after creating a YAML file named my_values.yaml, run the following command to deploy the Helm chart:
helm install my-splunk-otel-collector --values my_values.yaml splunk-otel-collector-chart/splunk-otel-collector
helm repo add π
Description π
Add the Splunk Distribution of OpenTelemetry Collector Helm chart repository.
Syntax π
helm repo add splunk-otel-collector-chart https://signalfx.github.io/splunk-otel-collector-chart
# Use these two commands together to add and update the repository at the same time
helm repo add splunk-otel-collector-chart https://signalfx.github.io/splunk-otel-collector-chart && helm repo update
helm repo update π
Description π
Update the Splunk Distribution of OpenTelemetry Collector Helm chart repository.
Syntax π
helm repo update https://signalfx.github.io/splunk-otel-collector-chart
journalctl π
Description π
Check the collector logs on the host.
Syntax π
journalctl -u splunk-otel-collector -f
tail -100 /var/log/messages
Optional arguments π
Argument |
Description |
---|---|
|
Show new log entries as they are added |
|
Retrieve the last 100 lines of logs from the log file |
|
Show messages for the specified systemd unit UNIT (such as a service unit), or for any of the units matched by PATTERN |
|
File where the log messages are displayed from |
kubectl config π
Description π
Modify Kubernetes configurations using subcommands. See the Kubectl Reference Documentation for a full list of subcommands and optional arguments.
Syntax π
kubectl config [subcommand]
# Examples
# Show kubeconfig settings
kubectl config view
# Save namespace for all subsequent kubectl commands in context
kubectl config set-context --current --namespace=ggckad-s2
# Get the password for the e2e user
kubectl config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}'
# Display the first user
kubectl config view -o jsonpath='{.users[].name}'
# Get a list of users
kubectl config view -o jsonpath='{.users[*].name}'
# Display list of contexts
kubectl config get-contexts
# Display the current-context
kubectl config current-context
# Set the default context to my-cluster-name
kubectl config use-context my-cluster-name
# Add a new user to your kubeconfig that supports basic authorization
kubectl config set-credentials kubeuser/foo.kubernetes.com --username=kubeuser --password=kubepassword
# Set a context utilizing a specific username and namespace
kubectl config set-context gce --user=cluster-admin --namespace=foo \ && kubectl config use-context gce
kubectl create π
Description π
Create a Kubernetes resource from a file. Accepted file formats are JSON and YAML. See the Kubectl Reference Documentation for a full list of subcommands and optional arguments.
Syntax π
sudo kubectl create -f <file-name>
# Examples
# Use the subcommand configmap to create a ConfigMap from a source file
sudo kubectl create configmap <map-name> --from-file=<file path>
Optional arguments π
Argument |
Description |
---|---|
|
The source file to create a resource |
|
Path to the source file to create a ConfigMap |
|
Name of the ConfigMap |
kubectl delete π
Description π
Delete a Kubernetes resource from a source file. See the Kubectl Reference Documentation for a full list of subcommands and optional arguments.
Syntax π
sudo kubectl delete -f <file-name>
Optional arguments π
Argument |
Description |
---|---|
|
The source file to delete a resource |
kubectl describe π
Description π
Check Kubernetes system configurations.
Syntax π
kubectl describe -n <namepsace> pod <pod-name>
Optional arguments π
Argument |
Description |
---|---|
|
Namespace to check the configurations |
|
Pod to check the configurations |
kubectl edit π
Description π
Edit a resource running on a Kubernetes container.
Syntax π
kubectl edit cm <name>
kubectl edit ds <name>
Optional arguments π
Argument |
Description |
---|---|
|
Specify the item you want to modify is a ConfigMap |
|
Specify the item you want to modify is a DaemonSet |
|
Name of the resource you want to modify |
kubectl exec π
Description π
Execute a command in a Kubernetes container.
Syntax π
kubectl exec -it <container/pod> -- curl <commands>
# Examples
# Initial configuration
kubectl exec -it my-splunk-otel-collector-agent-hg4gk -- curl http://localhost:55554/debug/configz/initial
# Effective configuration
kubectl exec -it my-splunk-otel-collector-agent-hg4gk -- curl http://localhost:55554/debug/effective
# Check status of the collector
kubectl exec -it <your-agent-pod> -- curl localhost:55679/debug/tracez | lynx -stdin
kubectl exec -it splunk-otel-collector-agent-f4gwg -- curl localhost:55679/debug/tracez | lynx -stdin
Optional arguments π
Argument |
Description |
---|---|
|
Your agent pod |
|
Any additional |
kubectl get π
Description π
Display one or many resources running on Kubernetes.
Syntax π
kubectl get pods -n <namespace>
kubectl get configmap
kubectl get ds
Optional arguments π
Argument |
Description |
---|---|
|
Display the ConfigMap |
|
Display the DaemonSet |
|
Namespace |
|
List all pods in process status output format |
kubectl logs π
Description π
Check logs in a Kubernetes container.
Syntax π
sudo kubectl logs <pod-name | type/name> -l <label> -f -c <container-name>
# Examples
# Return snapshot logs from pod nginx with only one container
kubectl logs nginx
# Return snapshot logs from pod nginx with multiple containers
kubectl logs nginx --all-containers=true
# Return snapshot logs from all containers in pods defined by label app=nginx
kubectl logs -l app=nginx --all-containers=true
# Return snapshot of previous terminated ruby container logs from pod web-1
kubectl logs web-1 -p -c ruby
# Begin streaming the logs of the ruby container in pod web-1
kubectl logs web-1 -f -c ruby
# Begin streaming the logs from all containers in pods defined by label app=nginx
kubectl logs -f -l app=nginx --all-containers=true
# Display only the most recent 20 lines of output in pod nginx
kubectl logs nginx --tail=20
# Show all logs from pod nginx written in the last hour
kubectl logs nginx --since=1h
# Show logs from a kubelet with an expired serving certificate
kubectl logs nginx --insecure-skip-tls-verify-backend
# Return snapshot logs from first container of a job named hello
kubectl logs job/hello
# Return snapshot logs from container nginx-1 of a deployment named nginx
kubectl logs deployment/nginx -c nginx-1
Optional arguments π
Argument |
Description |
---|---|
|
If true, get all containersβ logs in the pod(s). Default value is |
|
The container where the logs are displayed from |
|
Show new log entries as they are added |
|
Skip verifying the identity of the kubelet that logs are requested from. Use this when you want to get logs from a kubelet with an expired serving certificate |
|
A label to filter on |
|
If true, show the logs for the previous instance of the container in a pod if it exists. Default value is |
|
Get only the latest logs within the specified time duration |
|
Number of most recent log lines to show |
restart π
Description π
Restart the collector on the host. If the Fluentd service is installed, you can also restart it using sudo systemctl restart td-agent
.
Syntax π
sudo systemctl restart splunk-otel-collector
start π
Description π
Start the collector on the host. If the Fluentd service is installed, you can also start it using sudo systemctl start td-agent
.
Syntax π
sudo systemctl start splunk-otel-collector
status π
Description π
Check the status of the collector on the host. Only available for Linux .
Additionally, you can use the Health Check extension , which activates to probe an HTTP url to check the status of the OpenTelemetry Collector.
Syntax π
sudo systemctl status splunk-otel-collector
stop π
Description π
Stop the collector on the host. If the Fluentd service is installed, you can also stop it using sudo systemctl stop td-agent
.
Syntax π
sudo systemctl stop splunk-otel-collector