Skip to content

Commit a9a0647

Browse files
author
naman-msft
committed
updated docs
1 parent e75ea8c commit a9a0647

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

tools/ada.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
- title = the title of the Exec Doc
111111
- description = the description of the Exec Doc
112112
- ms.topic = what kind of a doc it is e.g. article, blog, etc.
113-
- ms.date = the date the Exec Doc was last updated by author
113+
- ms.date = the current date in the format MM/DD/YYYY
114114
- author = author's GitHub username
115115
- ms.author = author's username (e.g. Microsoft Alias)
116116
- **ms.custom = comma-separated list of tags to identify the Exec Doc (innovation-engine is the one tag that is mandatory in this list)**

tools/demo.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,10 @@ These examples show various ways to leverage the gadget for tracing executions i
108108
# Run simple example with trace_exec with a 10-second timeout to prevent indefinite execution:
109109
timeout 5s kubectl gadget run trace_exec || true
110110

111+
kubectl delete pod demo-pod
112+
111113
# Create a background pod that will generate events for us to trace:
112-
kubectl run demo-pod --image=ubuntu -- /bin/bash -c "for i in {1..30}; do echo Running commands...; ls -la /; sleep 1; done"
114+
kubectl run demo-pod --image=ubuntu -- /bin/bash -c "for i in {1..11}; do echo Running commands...; ls -la /; sleep 1; done"
113115

114116
# Wait briefly for the pod to start generating events
115117
sleep 5
@@ -118,7 +120,7 @@ sleep 5
118120
timeout 5s kubectl gadget run trace_exec --output jsonpretty || true
119121

120122
# Run gadget with filtering and timeout
121-
timeout 5s kubectl gadget run trace_exec --all-namespaces --filter proc.comm=bash || true
123+
timeout 5s kubectl gadget run trace_exec --all-namespaces --filter proc.comm=bash || echo "Attachment timed out, continuing with demo"
122124
```
123125

124126
Each command demonstrates a different facet of the gadget's capabilities, from initiating traces to filtering outputs based on process names.
@@ -139,20 +141,14 @@ cat alert-bad-process.yaml
139141

140142
## Exporting Metrics and Managing Gadget Lifecycle
141143

142-
This section deploys the gadget manifest using the YAML file created in the previous section. The command includes several annotations to instruct the gadget to collect metrics. The process is detached so that it runs in the background. Subsequently, the script lists the running gadget instances and attaches to the deployed alert for further inspection if necessary.
144+
This section deploys the gadget manifest using the YAML file created in the previous section. The command includes several annotations to instruct the gadget to collect metrics. The process is detached so that it runs in the background. Subsequently, the script lists the running gadget instances.
143145

144146
```bash
145147
# Clean up any existing instance of the same name
146148
kubectl gadget delete alert-bad-process
147149

148150
# Run gadget manifest to export metrics:
149151
kubectl gadget run -f alert-bad-process.yaml --annotate exec:metrics.collect=true,exec:metrics.implicit-counter.name=shell_executions,exec.k8s.namespace:metrics.type=key,exec.k8s.podname:metrics.type=key,exec.k8s.containername:metrics.type=key --detach
150-
151-
# Verify gadget is running in headless mode:
152-
153-
kubectl gadget list
154-
155-
timeout 5s kubectl gadget attach alert-bad-process
156152
```
157153

158154
These commands ensure that metrics are being collected as defined in the YAML manifest and verify that the gadget is running correctly in headless mode.

0 commit comments

Comments
 (0)