1"use strict";(self.webpackChunkig_website=self.webpackChunkig_website||[]).push([[15367],{18709:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>o,default:()=>b,frontMatter:()=>c,metadata:()=>a,toc:()=>d});const a=JSON.parse('{"id":"reference/headless","title":"Headless Mode","description":"How to run Gadgets without a client","source":"@site/docs/reference/headless.mdx","sourceDirName":"reference","slug":"/reference/headless","permalink":"/docs/latest/reference/headless","draft":false,"unlisted":false,"editUrl":"https://github.com/inspektor-gadget/inspektor-gadget/edit/main/docs/reference/headless.mdx","tags":[],"version":"current","sidebarPosition":310,"frontMatter":{"title":"Headless Mode","sidebar_position":310,"description":"How to run Gadgets without a client"},"sidebar":"mainSidebar","previous":{"title":"Gadget Instance Manifests","permalink":"/docs/latest/reference/manifests"},"next":{"title":"Configuration","permalink":"/docs/latest/reference/configuration"}}');var r=n(74848),s=n(28453),l=n(49489),i=n(7227);const c={title:"Headless Mode",sidebar_position:310,description:"How to run Gadgets without a client"},o=void 0,u={},d=[{value:"Creating Gadget Instances",id:"creating-gadget-instances",level:2},{value:"Listing Gadget Instances",id:"listing-gadget-instances",level:2},{value:"Attaching to a Gadget Instance",id:"attaching-to-a-gadget-instance",level:2},{value:"Deleting a Gadget Instance",id:"deleting-a-gadget-instance",level:2}];function g(e){const t={a:"a",admonition:"admonition",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.p,{children:"Instead of running Gadgets interactively, you can also install Gadget Instances on your server, so they keep running\neven if you are no longer connected. This also ensures that Gadgets will be resumed after a node restart or - depending\non the environment - when nodes are added to your cluster."}),"\n",(0,r.jsx)(t.admonition,{type:"tip",children:(0,r.jsxs)(t.p,{children:["If you are deploying Inspektor Gadget with Helm, you can pre-configure Gadget Instances directly in your\n",(0,r.jsx)(t.code,{children:"values.yaml"})," using the ",(0,r.jsx)(t.code,{children:"config.gadgetConfigMaps"})," option. See ",(0,r.jsx)(t.a,{href:"/docs/latest/reference/install-kubernetes#pre-configuring-gadget-instances",children:"Pre-configuring Gadget Instances"})," for details."]})}),"\n",(0,r.jsx)(t.h2,{id:"creating-gadget-instances",children:"Creating Gadget Instances"}),"\n",(0,r.jsxs)(t.p,{children:["To create a new Gadget Instance on your server / cluster, you can use the ",(0,r.jsx)(t.code,{children:"run"})," command with the ",(0,r.jsx)(t.code,{children:"--detach"})," option:"]}),"\n",(0,r.jsxs)(l.A,{groupId:"env",children:[(0,r.jsx)(i.A,{value:"gadgetctl",label:"gadgetctl",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:'$ gadgetctl run trace_exec:latest --detach\nINFO[0001] installed on node "local" as "61c8fdd9b75e1aec3c242347f18cf854"\n'})})}),(0,r.jsx)(i.A,{value:"kubectl-gadget",label:"kubectl-gadget",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:'$ kubectl gadget run trace_exec:latest --detach\nINFO[0001] installed as "f0ff5614be1a0da655ea308e13ce6605"\nID NAME TAGS GADGET\n4f5ae12c54bd serene_tu trace_open:latest\nf0ff5614be1a brave_bartik trace_exec:latest\n'})})})]}),"\n",(0,r.jsx)(t.p,{children:"The command returns the ID of the newly installed Gadget Instance."}),"\n",(0,r.jsxs)(t.admonition,{type:"warning",children:[(0,r.jsx)(t.p,{children:"When upgrading server versions, please make sure to also upgrade all existing Gadget Instances to avoid compatibility issues. For example in Kubernetes you should see following warning in the server logs:"}),(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{children:'$ kubectl logs -n gadget -l k8s-app=gadget\n...\ntime="2025-09-26T07:50:38Z" level=warning msg="This gadget was built with ig v0.42.0 and it\'s being run with v0.44.1. Gadget could be incompatible"\ntime="2025-09-26T07:50:40Z" level=error msg="running gadget: starting operators: starting operator \\"oci\\": starting operator \\"ebpf\\": creating eBPF collection: program ig_trace_dns: load program: bad CO-RE relocation: invali
1d func unknown#195896080 (303 line(s) omitted)"\n...\n'})}),(0,r.jsxs)(t.p,{children:["Please ",(0,r.jsx)(t.a,{href:"#deleting-a-gadget-instance",children:"delete"})," and re-create the Gadget Instance to resolve this."]})]}),"\n",(0,r.jsx)(t.h2,{id:"listing-gadget-instances",children:"Listing Gadget Instances"}),"\n",(0,r.jsx)(t.p,{children:"To list all existing Gadget Instances on the server, you can run:"}),"\n",(0,r.jsxs)(l.A,{groupId:"env",children:[(0,r.jsx)(i.A,{value:"gadgetctl",label:"gadgetctl",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"$ gadgetctl list\nID NAME TAGS GADGET\n4f5ae12c54bd serene_tu trace_open:latest\n61c8fdd9b75e brave_bartik trace_exec:latest\n"})})}),(0,r.jsx)(i.A,{value:"kubectl-gadget",label:"kubectl-gadget",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"$ kubectl gadget list\nID NAME TAGS GADGET\n4f5ae12c54bd serene_tu trace_open:latest\n61c8fdd9b75e brave_bartik trace_exec:latest\n"})})})]}),"\n",(0,r.jsx)(t.h2,{id:"attaching-to-a-gadget-instance",children:"Attaching to a Gadget Instance"}),"\n",(0,r.jsx)(t.p,{children:"If you want to see the output of the Gadget Instance, you can attach to it using the (partial) ID or name:"}),"\n",(0,r.jsxs)(l.A,{groupId:"env",children:[(0,r.jsx)(i.A,{value:"gadgetctl",label:"gadgetctl",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"$ gadgetctl attach 61c8fdd9b75e\nRUNTIME.CONTAINERNAME COMM PID TID PCOMM PPID ARGS ERR\u2026 USER LOGINUSER GROUP\nmagical_pike bash 282432 282432 containerd-s\u2026 282410 /bin/bash root uid:4294967\u2026 root\nmagical_pike groups 282454 282454 bash 282453 /usr/bin/gro\u2026 root uid:4294967\u2026 root\nmagical_pike dircolors 282456 282456 bash 282455 /usr/bin/dir\u2026 root uid:4294967\u2026 root\n\n$ gadgetctl attach brave_bartik\nRUNTIME.CONTAINERNAME COMM PID TID PCOMM PPID ARGS ERR\u2026 USER LOGINUSER GROUP\nmagical_pike bash 282432 282432 containerd-s\u2026 282410 /bin/bash root uid:4294967\u2026 root\nmagical_pike groups 282454 282454 bash 282453 /usr/bin/gro\u2026 root uid:4294967\u2026 root\nmagical_pike dircolors 282456 282456 bash 282455 /usr/bin/dir\u2026 root uid:4294967\u2026 root\n"})})}),(0,r.jsx)(i.A,{value:"kubectl-gadget",label:"kubectl-gadget",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"$ kubectl gadget attach 61c8fdd9b75e\nK8S.NODE K8S.NAMESPACE K8S.PODNAME K8S.CONTAINERNAME COMM PID TID UID GID FD FNAME MODE ERROR\nminikube-docker kube-system kube-proxy-hr474 kube-proxy kube-proxy 4653 4692 0 0 10 /dev/null ----------\nminikube-docker kube-system kube-proxy-hr474 kube-proxy kube-proxy 4653 4824 0 0 9 /dev/null ----------\nminikube-docker kube-system kube-proxy-hr474 kube-proxy iptables 102586 102586 0 0 0 /etc/ld.so.cache ---------- ENOENT\nminikube-docker kube-system kube-proxy-hr474 kube-proxy ip6tables 102587 102587 0 0 0 /etc/ld.so.cache ---------- ENOENT\nminikube-docker kube-system kube-proxy-hr474 kube-proxy iptables 102586 102586 0 0 0 /lib/aarch64-linux-gnu/tls/aarch64\u2026 ---------- ENOENT\nminikube-docker kube-system kube-proxy-hr474 kube-proxy ip6tables 102587 102587 0 0 0 /lib/aarch64-linux-gnu/tls/aarch64\u2026 ---------- ENOENT\n\n$ kubectl gadget attach brave_bartik\nK8S.NODE K8S.NAMESPACE K8S.PODNAME K8S.CONTAINERNAME COMM PID TID UID GID FD FNAME MODE ERROR\nminikube-docker kube-system kube-proxy-hr474 kube-proxy kube-proxy 4653 4692 0 0 10 /dev/null ----------\nminikube-docker kube-system kube-proxy-hr474 kube-proxy kube-proxy 4653 4824 0 0 9 /dev/null ----------\nminikube-docker kube-system kube-proxy-hr474 kube-proxy iptables 102586 102586 0 0 0 /etc/ld.so.cache ---------- ENOENT\nminikube-docker kube-system kube-proxy-hr474 kube-proxy ip6tables 102587 102587 0 0 0 /etc/ld.so.cache ---------- ENOENT\nminikube-docker kube-system kube-proxy-hr474 kube-proxy iptables 102586 102586 0 0 0 /lib/aarch64-linux-gnu/tls/aarch64\u2026 ---------- ENOENT\nminikube-docker kube-system kube-proxy-hr474 kube-proxy ip6tables 102587 102587 0 0 0 /lib/aarch64-linux-gnu/tls/aarch64\u2026 ---------- ENOENT\n"})})})]}),"\n",(0,r.jsx)(t.h2,{id:"deleting-a-gadget-instance",children:"Deleting a Gadget Instance"}),"\n",(0,r.jsxs)(t.p,{children:["To delete one or more Gadget Instances, just provide the names or (partial) IDs to the ",(0,r.jsx)(t.code,{children:"delete"})," command, like so:"]}),"\n",(0,r.jsxs)(l.A,{groupId:"env",children:[(0,r.jsx)(i.A,{value:"gadgetctl",label:"gadgetctl",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"$ gadgetctl delete 4f 61\n4f5ae12c54bd7c2058c0484ebd13dbc2\n61c8fdd9b75e1aec3c242347f18cf854\n"})})}),(0,r.jsx)(i.A,{value:"kubectl-gadget",label:"kubectl-gadget",children:(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"$ kubectl gadget delete 4f 61\n4f5ae12c54bd7c2058c0484ebd13dbc2\n61c8fdd9b75e1aec3c242347f18cf854\n"})})})]})]})}function b(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(g,{...e})}):g(e)}},7227:(e,t,n)=>{n.d(t,{A:()=>l});n(96540);var a=n(34164);const r={tabItem:"tabItem_Ymn6"};var s=n(74848);function l(e){let{children:t,hidden:n,className:l}=e;return(0,s.jsx)("div",{role:"tabpanel",className:(0,a.A)(r.tabItem,l),hidden:n,children:t})}}
1,49489:(e,t,n)=>{n.d(t,{A:()=>I});var a=n(96540),r=n(34164),s=n(24245),l=n(56347),i=n(36494),c=n(62814),o=n(45167),u=n(69900);function d(e){return a.Children.toArray(e).filter((e=>"\n"!==e)).map((e=>{if(!e||(0,a.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad <Tabs> child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.`)}))?.filter(Boolean)??[]}function g(e){const{values:t,children:n}=e;return(0,a.useMemo)((()=>{const e=t??function(e){return d(e).map((e=>{let{props:{value:t,label:n,attributes:a,default:r}}=e;return{value:t,label:n,attributes:a,default:r}}))}(n);return function(e){const t=(0,o.XI)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in <Tabs>. Every value needs to be unique.`)}(e),e}),[t,n])}function b(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.W6)(),s=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,c.aZ)(s),(0,a.useCallback)((e=>{if(!s)return;const t=new URLSearchParams(r.location.search);t.set(s,e),r.replace({...r.location,search:t.toString()})}),[s,r])]}function p(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,s=g(e),[l,c]=(0,a.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(t){if(!b({value:t,tabValues:n}))throw new Error(`Docusaurus error: The <Tabs> has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const a=n.find((e=>e.default))??n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:t,tabValues:s}))),[o,d]=h({queryString:n,groupId:r}),[p,m]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,s]=(0,u.Dv)(n);return[r,(0,a.useCallback)((e=>{n&&s.set(e)}),[n,s])]}({groupId:r}),f=(()=>{const e=o??p;return b({value:e,tabValues:s})?e:null})();(0,i.A)((()=>{f&&c(f)}),[f]);return{selectedValue:l,selectValue:(0,a.useCallback)((e=>{if(!b({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);c(e),d(e),m(e)}),[d,m,s]),tabValues:s}}var m=n(11062);const f={tabList:"tabList__CuJ",tabItem:"tabItem_LNqP"};var k=n(74848);function x(e){let{className:t,block:n,selectedValue:a,selectValue:l,tabValues:i}=e;const c=[],{blockElementScrollPositionUntilNextRender:o}=(0,s.a_)(),u=e=>{const t=e.currentTarget,n=c.indexOf(t),r=i[n].value;r!==a&&(o(t),l(r))},d=e=>{let t=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const n=c.indexOf(e.currentTarget)+1;t=c[n]??c[0];break}case"ArrowLeft":{const n=c.indexOf(e.currentTarget)-1;t=c[n]??c[c.length-1];break}}t?.focus()};return(0,k.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,r.A)("tabs",{"tabs--block":n},t),children:i.map((e=>{let{value:t,label:n,attributes:s}=e;return(0,k.jsx)("li",{role:"tab",tabIndex:a===t?0:-1,"aria-selected":a===t,ref:e=>c.push(e),onKeyDown:d,onClick:u,...s,className:(0,r.A)("tabs__item",f.tabItem,s?.className,{"tabs__item--active":a===t}),children:n??t},t)}))})}function v(e){let{lazy:t,children:n,selectedValue:s}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===s));return e?(0,a.cloneElement)(e,{className:(0,r.A)("margin-top--md",e.props.className)}):null}return(0,k.jsx)("div",{className:"margin-top--md",children:l.map(((e,t)=>(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==s})))})}function y(e){const t=p(e);return(0,k.jsxs)("div",{className:(0,r.A)("tabs-container",f.tabList),
1children:[(0,k.jsx)(x,{...t,...e}),(0,k.jsx)(v,{...t,...e})]})}function I(e){const t=(0,m.A)();return(0,k.jsx)(y,{...e,children:d(e.children)},String(t))}},28453:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>i});var a=n(96540);const r={},s=a.createContext(r);function l(e){const t=a.useContext(s);return a.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function i(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),a.createElement(s.Provider,{value:t},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.