OpenClaw - Part 05: Implementation of the it-claw agent

In short
  • Building a custom OpenClaw image using kubectl.
  • Runtime directory structure and systemd quadlets for vault-agent and the agent, running rootless with Podman.
  • Configuration of openclaw.json and SOUL.md (agent personality).
  • Interaction via Telegram and the GUI; overview and limitations of the approach.

Introduction

Now is the time to complete the cookbook and finally be able to execute (and especially test) the first IT claw agent.

As a reminder, the goal was to create a secure environment for running one or more agents based on OpenClaw.

The general strategy adopted involved configuring a dedicated server running Rocky Linux. We then deployed a set of prerequisites associated with a dedicated user, and installed Podman, allowing each agent to run in a separate container.

Next, the specialized Vault tool for storing sensitive items was deployed so that we could deposit its own secrets for this first agent.

This will need to be able to connect to a Kubernetes cluster in read-only mode to serve as a tracking and monitoring solution that can be queried via Telegram.

Focus and reminder about the directory structure

Before proceeding with the actions, I would like to remind you of the directory structure chosen for the project. It is important to understand it well and keep it in mind, because a large part of the security relies on the proper management of rights and usage of each directory.

Path Perms / Owner Role
/var/lib/openclaw/ 700 openclaw:openclaw Home directory for the openclaw service account. The 700 setting isolates the agent from other local users.
.config/containers/systemd/ openclaw Podman quadlets. systemctl --user daemon-reload These are translated into systemd units.
.config/containers/systemd/vault-agent-it-claw.container openclaw Definition of the vault-agent container (image, volumes, User=1000).
.config/containers/systemd/it-claw.container openclaw Definition of the it-claw agent container (image, PublishPort, network, volumes).
build/openclaw-it/ openclaw Image build context.
build/openclaw-it/Dockerfile openclaw Recipe for the image localhost/openclaw-it:vN (base OpenClaw + kubectl + jq).
vault/ openclaw:openclaw Root of the Vault material on the host side, mounted read-only in the vault-agent container.
vault/agent/it-claw/ openclaw Configuration of the vault-agent, namespaced per agent (a subdirectory per agent). Mounted on /vault/config.
vault/agent/it-claw/agent-it-claw.hcl openclaw HCL configuration for the vault-agent: auto_auth AppRole, sink token, cache, template blocks.
vault/agent/it-claw/templates/ openclaw Consul-template templates (one .tpl per secret). Referenced internally as /vault/config/templates/.
vault/it-claw-role-id 644 openclaw role_id of the AppRole. 644 is required for reading by the rootless container after namespace mapping.
vault/it-claw-secret-id 644 openclaw secret_id of the AppRole (renewed during rotation).
vault/tls/ openclaw TLS trust configuration for connecting to Vault. Mounted on /vault/tls.
vault/tls/ca.crt 644 openclaw CA (COOLCORP chain) validating the certificate of the Vault listener.
instances/it-claw/ openclaw Runtime root directory of the it-claw agent (one instance = one agent).
instances/it-claw/sink/ 770, UID 100999 Secret rendezvous point. vault-agent (User=1000) writes to it; it-claw mounts it as read-only on …/.openclaw/sink.
instances/it-claw/sink/telegram_token 600 Telegram bot token, materialized by vault-agent from Vault.
instances/it-claw/sink/gateway_token 600 Token for the OpenClaw gateway.
instances/it-claw/sink/kubeconfig 600 Kubeconfig (SA svc-openclaw-it, ClusterRole view) consumed by kubectl.
instances/it-claw/sink/.vault-token 600 Current Vault token issued by auto_auth (automatically renewed).
instances/it-claw/sink/.agent.pid — PID of the vault-agent process (declared by pid_file).
instances/it-claw/state/ 750, UID 100999 (= node) Persistent state of OpenClaw, mounted on /home/node/.openclaw. Owned by internal UID 1000 of the container (= 100999 on the host).
instances/it-claw/state/openclaw.json 640, UID 1000 Main configuration of the agent (gateway, trusted-proxy auth, models, plugins, secrets).
instances/it-claw/state/workspace/ UID 1000 Agent workspace (referenced by agents.defaults.workspace).
instances/it-claw/state/workspace/SOUL.md 640, UID 1000 Identity, capabilities, and limitations of the agent (loaded via the boot-md hook).
instances/it-claw/state/canvas/ UID 1000 Created at runtime, OpenClaw canvas data.
instances/it-claw/state/agents/ UID 1000 Created at runtime, per-agent state (sessions, history *.jsonl, etc.).
instances/it-claw/state/identity/ UID 1000 Created at runtime, instance identity/keys.

Some directories do not yet exist, but we will create and manipulate them later. Others have already been seen and processed in previous articles.

Building the container

The agent will run as a container. So, we start by creating the image that will include the command-line interface kubectl so that the agent can use it.

To do this, we switch to the context of our dedicated user responsible for managing agents.

sudo machinectl shell openclaw@
Switching to the openclaw user context for building the custom image

Click the image to enlarge.

Now that we are in the correct user context, we will create a directory for building containers, within which we will create a subdirectory specific to our agent.

mkdir -p ~/build/openclaw-it
cd ~/build/openclaw-it
Positioning within the openclaw user context and creating the build directory for the it-claw agent

Click the image to enlarge.

We create the Dockerfile with the following content.

cat > Dockerfile <<'EOF'
FROM ghcr.io/openclaw/openclaw:2026.5.28

USER root

ARG KUBECTL_VERSION=v1.34.0
RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \
    && curl -sfL "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" -o /usr/local/bin/kubectl \
    && curl -sfL "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl.sha256" -o /tmp/kubectl.sha256 \
    && echo "$(cat /tmp/kubectl.sha256)  /usr/local/bin/kubectl" | sha256sum -c - \
    && chmod +x /usr/local/bin/kubectl \
    && rm -f /tmp/kubectl.sha256 \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get install -y --no-install-recommends jq \
    && apt-get clean && rm -rf /var/lib/apt/lists/*

USER node

LABEL org.opencontainers.image.title="openclaw-it"
LABEL org.opencontainers.image.description="OpenClaw with kubectl for K8S agents"
LABEL org.opencontainers.image.base.name="ghcr.io/openclaw/openclaw:latest"
EOF
Dockerfile for the custom it-claw agent image, based on the official OpenClaw image and including kubectl and jq

Click the image to enlarge.

In this Dockerfile, we set the version of kubectl to be retrieved, as it must match the version of the cluster that the agent will need to query.

Then, we proceed to retrieve the openclaw container available on ghcr.io.

We build the image.

podman build -t localhost/openclaw-it:v1 .
Building the custom it-claw agent image

Click the image to enlarge.

We verify that it is functional.

podman images | grep openclaw-it
podman run --rm localhost/openclaw-it:v1 kubectl version --client
podman run --rm localhost/openclaw-it:v1 jq --version
Testing the custom it-claw agent image to verify the presence of kubectl and jq

Click the image to enlarge.

Creating the directories

Before running it permanently, we need to ensure that the entire necessary subtree is present for the agent (hence my reminder at the beginning of the article).

# Répertoires principaux
mkdir -p ~/instances/it-claw/sink
mkdir -p ~/instances/it-claw/state/workspace
mkdir -p ~/instances/it-claw/state/canvas
mkdir -p ~/instances/it-claw/state/agents
mkdir -p ~/instances/it-claw/state/identity
Creating the runtime directory structure for the it-claw agent

Click the image to enlarge.

Focus on the sink folder

One of the most critical directories is the sink directory. It acts as an intermediary, where the future Vault container (different from the agent's container) will deposit the confidential information needed by the agent, and it is also where the agent will read this information.

The AI agent will not be aware of the Vault client; it will simply read the contents of the sink directory.

Therefore, this directory must be accessible for writing by the Vault client, but only for reading by the AI agent.

We therefore set the following permissions.

chmod 770 ~/instances/it-claw/sink

For now, the permission is too broad, but we will adjust the permissions of the files themselves within the sink directory.

Focus on UIDs and users

Indeed, the base image of OpenClaw runs its Node.js application under the node user, which historically has a UID of 1000. OpenClaw has very strict internal security measures: it refuses to run if the permissions on its confidential information are deemed too permissive (it requires a permission level of 0600). Furthermore, it must be the owner of these files in order to read them.

This point is important because, by default, the Vault image we will use later runs under the internal vault user (which has a UID of 100). We need to modify this behavior to prevent Vault from writing secrets to the sink directory with a UID of 100. In that case, the OpenClaw agent (UID 1000) would simply not have permission to read them (because the files would be set to 0600 for UID 100).

Also, due to the UID 1000 of OpenClaw within its container and the fact that we are in a rootless environment, it is important to consider that, at the time of agent startup and during its execution, OpenClaw must create subdirectories (such as canvas/ or agents/) within the state/ directory. If the directory does not belong to it, the OpenClaw agent will fail.

We therefore need to use the following two commands.

podman unshare chown -R 1000:1000 ~/instances/it-claw/state
podman unshare chmod -R 750 ~/instances/it-claw/state
Assigning ownership and permissions of the 'state' directory to UID 1000 so that the rootless container can write to it

Click the image to enlarge.

The podman unshare command allows you to run a command by temporarily entering Podman's user namespace. Within this isolated "bubble", our OpenClaw technical user virtually becomes root (internal UID 0) and gains exclusive permission to manipulate the sub-UIDs (SubUIDs) allocated to it.

This is the only way for a non-privileged user to perform a chown operation targeting the internal UID of a container.

That is the downside of choosing a rootless runtime environment with podman. However, it strengthens security, provided you get the permissions right.

Before we continue with the Vault container, let's summarize the relationships between the OS UIDs, the Podman sub-UIDs, and our containers.

Component / Container User (within the container) Internal UID (container) Real User (host) Real UID (host Rocky Linux) Explanation
Host, session systemd --user / Podman — — openclaw 994 (GID 994) Service account that owns the session and launches the rootless containers. This is the core of all the mapping.
Root of the user namespace (all containers) root 0 openclaw 994 The internal UID 0 maps to the openclaw account on the host, not the actual system root. No real privileges are obtained.
vault-agent-it-claw (forced User=1000:1000) 1000 none (unnamed subuid) 100999 UID forced to 1000 so that the secrets written to sink/ are owned by 100999, making them readable by it-claw.
it-claw node 1000 none (unnamed subuid) 100999 node = the default user of the OpenClaw image. It has the same effective UID as vault-agent → reading files sink/ with permissions 0600.
(reference) image hashicorp/vault not overridden vault 100 none (unnamed subuid) 100099 Historical UID for Vault, intentionally unused: otherwise, the secrets would be in 100099, making them unreadable by it-claw (100999).

Processing the Vault agent (client)

Now we're moving on to the Vault part.

Please note that I will use the term 'Vault agent', which should not be confused with our AI agent.

As a reminder, each AI agent will be accompanied by its own Vault agent.

Each Vault agent has its own folder. This allows us to isolate configurations and templates per Vault agent.

In our case: vault/agent/it-claw/.

Creating the templates

So, we are creating the folder for the templates.

mkdir -p ~/vault/agent/it-claw/templates

Vault template files are small instruction files used by the Vault agent container to extract, format, and store secrets. They use the consul-template syntax.

When you query Vault to obtain a secret, Vault doesn't just return the password string. It returns a complex object containing metadata and the wrapped data.

The template acts as a translator so that only the raw data usable by the AI agent is deposited in the files within the sink folder.

Therefore, there will be one template per secret to retrieve.

# Template Telegram token
cat > ~/vault/agent/it-claw/templates/telegram_token.tpl <<'EOF'
{{ with secret "secret/data/openclaw/it-claw/telegram_token" }}{{ .Data.data.value }}{{ end }}
EOF

# Template Gateway token
cat > ~/vault/agent/it-claw/templates/gateway_token.tpl <<'EOF'
{{ with secret "secret/data/openclaw/it-claw/gateway_token" }}{{ .Data.data.value }}{{ end }}
EOF

# Template Kubeconfig
cat > ~/vault/agent/it-claw/templates/kubeconfig.tpl <<'EOF'
{{ with secret "secret/data/openclaw/it-claw/kubeconfig" }}{{ .Data.data.value }}{{ end }}
EOF
Writing consul-template scripts to extract secrets from Vault and format them in the 'sink' directory

Click the image to enlarge.

Each template references, as a source, the location of the secret within the key/value store (Vault) where we have stored our confidential information.

Configuration

Next, we will configure the Vault agent. This configuration is declared in a HCL (HashiCorp Configuration Language) file that contains several blocks of instructions.

cat > ~/vault/agent/it-claw/agent-it-claw.hcl <<'EOF'
pid_file = "/vault/sink/.agent.pid"

vault {
  address = "https://prdlinage501.coolcorp.priv:8200"
  ca_cert = "/vault/tls/ca.crt"

  retry {
    num_retries = 5
  }
}

auto_auth {
  method "approle" {
    mount_path = "auth/approle"
    config = {
      role_id_file_path   = "/vault/auth/role-id"
      secret_id_file_path = "/vault/auth/secret-id"
      remove_secret_id_file_after_reading = false
    }
  }

  sink "file" {
    config = {
      path = "/vault/sink/.vault-token"
      mode = 0600
    }
  }
}

cache {
  use_auto_auth_token = true
}

listener "tcp" {
  address = "127.0.0.1:8100"
  tls_disable = true
}

template {
  source      = "/vault/config/templates/telegram_token.tpl"
  destination = "/vault/sink/telegram_token"
  perms       = 0600
}

template {
  source      = "/vault/config/templates/gateway_token.tpl"
  destination = "/vault/sink/gateway_token"
  perms       = 0600
}

template {
  source      = "/vault/config/templates/kubeconfig.tpl"
  destination = "/vault/sink/kubeconfig"
  perms       = 0600
}
# Note : les sources /vault/config/templates/ correspondent au montage
# Volume=%h/vault/agent/it-claw:/vault/config dans le Quadlet.
EOF
Configuring the vault-agent using HCL to connect to Vault, authenticate via AppRole, retrieve secrets using templates, and deposit them in the 'sink' directory

Click the image to enlarge.

We are addressing the local instance of Vault. We also find references to our templates there.

Creating the quadlet

We will not build a specific image. The default image works very well. However, we will need to start it with a set of specific parameters.

To do this, we will use a Quadlet.

A Quadlet is a native tool integrated into Podman that acts as a "translator" between Podman and systemd. It allows you to manage the lifecycle of containers in a declarative way, just like you manage classic Linux services.

In essence, we declare a container in the same way we declare a service for systemd.

Therefore, we create a specific folder for this within our directory structure.

mkdir -p ~/.config/containers/systemd
Creating a directory for the systemd quadlet that will manage the vault agent container

Click the image to enlarge.

Then, we declare the configuration for the Vault container there.

cat > ~/.config/containers/systemd/vault-agent-it-claw.container <<'EOF'
[Unit]
Description=Vault Agent for it-claw
Wants=network-online.target
After=network-online.target

[Container]
Image=docker.io/hashicorp/vault:2.0.1
ContainerName=vault-agent-it-claw

Network=slirp4netns

# keep-id préserve le mapping user namespace
UserNS=keep-id

# Forcer UID 1000 pour que les fichiers écrits soient owned par UID 1000 = node côté it-claw
User=1000:1000

# Config it-claw uniquement (namespaced par agent — évite les conflits avec d'autres agents)
Volume=%h/vault/agent/it-claw:/vault/config:Z,ro
Volume=%h/vault/it-claw-role-id:/vault/auth/role-id:Z,ro
Volume=%h/vault/it-claw-secret-id:/vault/auth/secret-id:Z,ro
Volume=%h/vault/tls:/vault/tls:Z,ro

# Sink en écriture (shared avec it-claw qui le lit en :ro)
Volume=%h/instances/it-claw/sink:/vault/sink:Z

# Bypass de l'entrypoint défaillant (qui tente un chown sur /vault/config en :ro)
Entrypoint=/bin/vault
Exec=agent -config=/vault/config/agent-it-claw.hcl

NoNewPrivileges=true

[Service]
Restart=on-failure
RestartSec=10
TimeoutStartSec=60

[Install]
WantedBy=default.target
EOF
Configuring the quadlet for the vault-agent container of the it-claw agent, with specific parameters for networking, volumes, user, and entrypoint

Click the image to enlarge.

There are a few specifics to this configuration.

From a network perspective, we use slirp4netns, which is the historical networking engine for rootless containers.

Under Rocky 10, this is not the default engine, which is called pasta. I cannot use it because, although more performant, it caused problems for me when trying to use the host's fully qualified domain names (FQDNs) from within the containers. Slirp4netns essentially performs NAT and simplifies the process.

We also note in the configuration that we force the user ID within the container so that the Vault agent runs as UID 1000 to match the user on the IT-Claw node.

We also bypass the default entrypoint of the image to circumvent its default configuration and avoid permission assignment operations that failed in rootless mode.

Handling the IT-Claw agent

OpenClaw configuration

Now, let's move on to the OpenClaw configuration.

This is not always straightforward and often evolves. It is an openclaw.json file.

When deploying OpenClaw in a standard way, you only need to follow the configuration wizard. Here, we will have to declare everything manually.

This translates to the following file.

cat > /tmp/openclaw.json <<'EOF'
{
    "gateway": {
      "trustedProxies": ["10.0.2.0/24"],
      "mode": "local",
      "port": 18790,
      "bind": "lan",
      "nodes": {
        "pairing": {
          "autoApproveCidrs": ["192.168.10.0/24", "10.0.2.0/24"]
        }
      },
      "controlUi": {
        "allowedOrigins": ["https://it-claw.coolcorp.priv"]
      },
      "auth": {
        "mode": "trusted-proxy",
        "trustedProxy": {
          "userHeader": "x-forwarded-user",
          "allowUsers": ["bvivi57"]
        }
      }
    },
    "agents": {
      "defaults": {
        "workspace": "/home/node/.openclaw/workspace",
        "model": {
          "primary": "ollama/qwen3.5:latest"
        },
        "models": {
          "ollama/qwen3.5:latest": { "alias": "qwen3.5" }
        }
      }
    },
    "models": {
      "mode": "merge",
      "providers": {
        "ollama": {
          "baseUrl": "http://192.168.10.2:11434",
          "apiKey": "OLLAMA_API_KEY",
          "api": "ollama",
          "models": [
            {
              "id": "qwen3.5:latest",
              "name": "qwen3.5:latest",
              "reasoning": false,
              "input": ["text"],
              "cost": {
                "input": 0,
                "output": 0,
                "cacheRead": 0,
                "cacheWrite": 0
              },
              "contextWindow": 32768,
              "maxTokens": 4096
            }
          ]
        }
      }
    },
    "session": {
      "dmScope": "per-channel-peer"
    },
    "tools": {
      "profile": "coding"
    },
    "auth": {
      "profiles": {
        "ollama:default": {
          "provider": "ollama",
          "mode": "api_key"
        }
      }
    },
    "secrets": {
      "providers": {
        "telegram-token": {
          "source": "file",
          "path": "/home/node/.openclaw/sink/telegram_token",
          "mode": "singleValue"
        },
        "gateway-token": {
          "source": "file",
          "path": "/home/node/.openclaw/sink/gateway_token",
          "mode": "singleValue"
        }
      }
    },
    "channels": {
      "telegram": {
        "enabled": true,
        "dmPolicy": "allowlist",
        "allowFrom": ["tg:votre_id"],
        "botToken": {
          "source": "file",
          "provider": "telegram-token",
          "id": "value"
        }
      }
    },
    "plugins": {
      "entries": {
        "ollama": { "enabled": true },
        "bonjour": { "enabled": false }
      }
    },
    "hooks": {
      "internal": {
        "enabled": true,
        "entries": {
          "boot-md": { "enabled": true },
          "session-memory": { "enabled": true },
          "command-logger": { "enabled": true }
        }
      }
    }
  }
EOF
Configuring openclaw.json for the it-claw agent with parameters for gateway, agent, model, authentication, secrets, and plugins

Click the image to enlarge.

Several critical elements in this configuration.

First, right from the beginning, we use the "trustedProxies": ["10.0.2.0/24"] option, which allows OpenClaw to trust our reverse proxy NGINX that we deployed previously.

It is important to know that for access to the GUI, OpenClaw uses a rather complex device approval mechanism.

In my case, I have simplified this approach by using NGINX, which adds an authentication layer.

Specifically, the trusted-proxy mode is configured to retrieve the user's header so that OpenClaw can determine if the user is among the authorized individuals via the allowUsers option.

Further down, we define the characteristics of the models to be used and which LLM instance to use.

In my case, I decided to use the open-weight model qwen3.5 offered by Alibaba, the Chinese cloud giant.

With 9 billion parameters in its basic version, it is a fairly general-purpose model that can run correctly on both my GPU and my Macbook Pro.

For now, I will point the configuration to my Ollama instance installed on my PC. This means that my Nvidia 5070 Ti GPU and its 16 GB of VRAM will be used.

Please note that the baseUrl is in HTTP and points directly to port 11434 on the local IP address of my PC.

This is a significant limitation in terms of security. Internally, the Ollama API does not support HTTPS and does not provide an authentication mechanism. The API key only applies to the cloud portion of Ollama.

This is a known issue that the developers are aware of. This means that all traffic between your agents and Ollama is not encrypted.

While it can be assumed that this should not cause problems internally, it is still problematic in an enterprise environment.

Not to mention that any machine on your internal network could potentially request the Ollama instance if you do not implement a firewall filter on the PC hosting the tool.

I will certainly expand this article with a method for enabling HTTPS, but for now, I am going to try to complete the experiment.

Note that, by default, Ollama only listens on its localhost; you need to enable network support at the options level.

Enabling network support in the Ollama configuration to allow OpenClaw to communicate with the Qwen3.5 model via HTTP

Click the image to enlarge.

It is also important to consider the following configuration points:

  • contextWindow: This is the total size of the model's "short-term memory" (how many tokens it can store in memory for a conversation, including the system prompt, history, and its own response). It is set to approximately 32k tokens, which corresponds to the model and, more importantly, my available VRAM on my GPU. You sometimes need to adjust this parameter to improve performance.
  • maxTokens: This is the maximum number of tokens that the model is allowed to generate in a single response. This parameter acts as a "reserve" within the overall context window. OpenClaw ensures that this space is always available within the contextWindow to allow the model to express itself.

These two options are very important, and I had a lot of trouble initially setting them correctly, but for this, traditional AI like Claude, Gemini, or ChatGPT can help, depending on the chosen model and your hardware.

Without proper settings at this level, your agent will be unusable.

The choice of API is also important. By default, OpenClaw offers OpenAI-completions, which is not optimal with Ollama.

Also, be careful about the tools that are enabled. Many plugins are available for OpenClaw, but if you enable too many or some that will not be useful to you, you risk saturating the agent's context, as each tool adds its own overhead.

There is also the choice of profile.

"tools": {
      "profile": "coding"
    },

Using the coding profile will natively allow a set of built-in executables designed for administration and development, including shell commands (bash), file manipulation, or even the use of grep.

It is thanks to enabling the shell that kubectl can be called by the agent.

Other parameters are present, including the Telegram section where you need to enter your user ID, which was retrieved previously.

However, you will notice that the telegram-token and the gateway-token are not hardcoded in the configuration.

We only reference the location where OpenClaw can find these elements as files, namely the ones written by the Vault agent.

Because of permission restrictions, again related to our directory structure, I went through the /tmp folder to create the OpenClaw configuration file.

Now, you need to move this file to the correct location and apply the appropriate permissions.

podman unshare cp /tmp/openclaw.json ~/instances/it-claw/state/openclaw.json
podman unshare chown 1000:1000 ~/instances/it-claw/state/openclaw.json
podman unshare chmod 640 ~/instances/it-claw/state/openclaw.json
Reassigning ownership and permissions of the openclaw.json configuration file to UID 1000 so that the rootless container can read it

Click the image to enlarge.

Remember that OpenClaw is very sensitive to the permissions of its files.

Creating the SOUL

Now let's define the personality of our agent. In OpenClaw, we talk about soul, and this is done through the SOUL.md file.

cat > /tmp/SOUL.md <<'EOF'
# it-claw — Assistant IT Kubernetes

Je suis it-claw, un assistant spécialisé dans l'observation d'un cluster Kubernetes homelab.

## Capacités

Je peux interroger le cluster Kubernetes en lecture seule pour :
- Lister les nodes, leur statut et leurs ressources
- Lister les pods par namespace avec leur état
- Afficher les events récents pour identifier les problèmes
- Consulter deployments, services, ingresses, configmaps
- Vérifier les logs d'un pod (`kubectl logs`)
- Décrire une ressource (`kubectl describe`)

## Contexte cluster

La variable `KUBECONFIG` pointe vers `/home/node/.openclaw/sink/kubeconfig`.
J'utilise `kubectl` pour toutes les interactions.

Exemples de commandes :
- `kubectl get pods -A`
- `kubectl get nodes -o wide`
- `kubectl describe pod <nom> -n <namespace>`
- `kubectl get events -n <namespace> --sort-by='.lastTimestamp'`
- `kubectl logs <pod> -n <namespace> --tail=100`

## Limites strictes

Je suis strictement en lecture seule. Je n'ai pas les droits pour :
- Créer, modifier ou supprimer des ressources Kubernetes
- Appliquer des manifestes YAML
- Effectuer des `kubectl exec` dans des pods
- Port-forward vers des services
- Lire les Secret Kubernetes (qui contiennent des credentials)

Si l'utilisateur demande une action modificatrice, je refuse en expliquant mon rôle observationnel. Je peux suggérer la commande à exécuter manuellement.

## Format de réponse

- Concis, adapté à Telegram
- Emojis de statut : ✅ healthy, ⚠️ warning, ❌ error, 🔄 rolling
- Résumé d'abord, détail sur demande
- Français par défaut

## Confidentialité

Je ne révèle jamais :
- Le contenu du kubeconfig ou le token du ServiceAccount
- Les tokens, secrets ou credentials visibles dans les ressources K8S
- Les IPs internes des nodes sans nécessité

## Comportement par défaut

Pour un simple "bonjour", je me présente brièvement et propose 2-3 exemples de questions que je peux traiter.
EOF
Example content of the SOUL.md file, which defines the personality, capabilities, limitations, and behavior of the IT-Claw agent

Click the image to enlarge.

This is a simple Markdown file whose content is very important. It will define your agent's behavior, its role, what it can do, but most importantly, what it should not do.

You shouldn't create too large a file either, because this context is sent to the LLM with each interaction. Suggesting a soul that is too complex may compromise the maximum execution limit defined in the OpenClaw configuration file.

Once again, we move the file to the correct location and set the correct permissions.

podman unshare cp /tmp/SOUL.md ~/instances/it-claw/state/workspace/SOUL.md
podman unshare chown 1000:1000 ~/instances/it-claw/state/workspace/SOUL.md
podman unshare chmod 640 ~/instances/it-claw/state/workspace/SOUL.md
Assigning ownership and permissions of the SOUL.md file so that the rootless container can read it, and the agent has its personality defined at startup

Click the image to enlarge.

We are almost at the end.

IT-Claw agent quadlet

We can now proceed to the agent's quadlet. Just like with Vault, this will allow us to launch our OpenClaw instance with our custom image and some additional environment variables, including the KUBECONFIG variable to indicate the location of the configuration related to kubectl.

cat > ~/.config/containers/systemd/it-claw.container <<'EOF'
[Unit]
Description=OpenClaw agent - it-claw
Wants=network-online.target
After=network-online.target vault-agent-it-claw.service
Requires=vault-agent-it-claw.service

[Container]
Image=localhost/openclaw-it:v1
ContainerName=it-claw

Network=slirp4netns
UserNS=keep-id

PublishPort=127.0.0.1:18790:18790

# state writable (OpenClaw crée canvas/, agents/, identity/ au runtime)
Volume=%h/instances/it-claw/state:/home/node/.openclaw:Z

# sink read-only (vault-agent l'alimente)
Volume=%h/instances/it-claw/sink:/home/node/.openclaw/sink:Z,ro

Environment=KUBECONFIG=/home/node/.openclaw/sink/kubeconfig
Environment=OPENCLAW_NO_RESPAWN=1
Environment=NODE_ENV=production

NoNewPrivileges=true

[Service]
Restart=on-failure
RestartSec=15
TimeoutStartSec=180

[Install]
WantedBy=default.target
EOF
Quadlet for the it-claw agent with network, volume, and environment parameters.

Click the image to enlarge.

This is, of course, our kubeconfig configuration created in the previous article and stored in the Vault secrets database; it will be brought back as a file in the sink folder by the Vault agent.

Now, from a session with our standard user on our server prdlinage501, we re-apply the SELinux configuration.

sudo restorecon -Rv /var/lib/openclaw/vault/
sudo restorecon -Rv /var/lib/openclaw/instances/
Applying SELinux contexts to the directories of the agent

Click the image to enlarge.

Launching containers and starting the agent

We switch back to our specific user for managing agents (sudo machinectl shell openclaw@) because it is time to start our containers using the following commands.

systemctl --user daemon-reload
systemctl --user start vault-agent-it-claw.service
Starting the containers of the it-claw agent and its associated vault agent via systemctl

Click the image to enlarge.

Starting the containers of the it-claw agent and its associated vault agent via systemctl

Click the image to enlarge.

You need to wait a few minutes while the IT-Claw agent starts.

The Vault agent is faster, and after a few seconds, you should be able to list items in ~/instances/it-claw/sink/.

ls -la ~/instances/it-claw/sink/

You will find the files associated with our secrets there. Note that if you can list them, you cannot read them, which is normal behavior.

You can check the status of the containers using the usual commands for systemctl and podman.

As well as the logs of the it-claw agent.

journalctl --user -u it-claw.service -f
Reading the logs of the it-claw agent to verify its startup and proper functioning

Click the image to enlarge.

Interacting with the agent

The long-awaited moment has finally arrived: interacting with the agent.

To do this, we launch Telegram and try to communicate with our bot itbot created previously.

If it works, you should see an increase in GPU memory usage on the machine where Ollama is deployed.

Increased GPU memory usage during interaction with the it-claw agent via Telegram, indicating that the model is processing a request

Click the image to enlarge.

In my experience, the interactions quickly become smooth, except for an initial period that is a bit slow while I wait for the agent to wake up and the model to load into video memory.

Please note that Ollama does not constantly keep this model in memory. If you don't use the agent, and therefore the Ollama instance, it will unload the model, which can make the first conversation a bit long again.

However, it is fully functional, and as you can see in the following screenshots, the agent does its job perfectly.

Example of interaction with the it-claw agent via Telegram, with a question about the status of the Kubernetes cluster and the detailed response from the agent

Click the image to enlarge.

Example of interaction with the it-claw agent via Telegram, with a question about the status of the Kubernetes cluster and the detailed response from the agent

Click the image to enlarge.

Example of interaction with the it-claw agent via Telegram, with a question about the status of the Kubernetes cluster and the detailed response from the agent

Click the image to enlarge.

Example of interaction with the it-claw agent via Telegram, with a question about the status of the Kubernetes cluster and the detailed response from the agent

Click the image to enlarge.

I can even ask it to send me a report on my cluster every day.

Creation of automated reports by the it-claw agent, with a question about the possibility of receiving a daily report on the status of the Kubernetes cluster, and the positive response from the agent

Click the image to enlarge.

Accessing the GUI

You can also test access to the graphical interface. As before, we have deployed an NGINX instance to expose and secure access; you can try the URL https://it-claw.coolcorp.priv.

This requires authentication handled by NGINX, and since I am using a username configured in the OpenClaw configuration, I can successfully access the GUI.

Successful authentication to the OpenClaw GUI via NGINX, with the login page requesting credentials and access granted after submission

Click the image to enlarge.

Interface of the it-claw agent, with a list of conversations, configuration options, and available tools

Click the image to enlarge.

(Please note that it seems that, since the latest versions of OpenClaw, this method of accessing through the NGINX proxy is no longer functional; I will update the article as I find an alternative).

Conclusion

We have finally reached the end of this cookbook.

Even with the use of AI, it has not been without its challenges. All these tools are constantly evolving and often too quickly to take the time to properly utilize them in a secure context.

OpenClaw is a perfect example of an application that has been overtaken by its own hype, and very quickly, the application was criticized for its security… But, as you have seen in these articles, doing things securely takes a lot of time and, above all, makes the final architecture more complex.

Moreover, in the case of OpenClaw, it was an entirely new tool with no real precedents; we had to learn from the mistakes of the first implementations and allow the project to mature. The releases of OpenClaw are frequent, leading to frequent changes in the configuration method. What was true in one version is not necessarily true in another.

Today, better-designed alternatives, such as Hermès, are available; I will have to test it quickly because it seems to offer greater stability and a more mature logic than OpenClaw.

Regardless, by using tools like Vault and following certain best practices, such as rootless containers, we can achieve a higher level of security and make deployments more suitable for enterprise environments.

Everything that has been done here can be applied to a new agent, specializing in another area. My initial goal was to create a logic that could be reused for other cases.

Of course, the proposal is not perfect, and some aspects could be improved. Security is never perfect, so it's an ongoing process of improvement that needs to be implemented. I will try to update the articles as much as possible if I can find ways to improve them.

I am convinced that the future of IT is linked to agents, and that many of our activities will be profoundly changed in the coming months and years. From monitoring to CI/CD, the traditional approaches based on stacks of tools and historical organizational structures will need to be re-evaluated.

I believe it's better to integrate multiple specialized agents into specific roles rather than trying to do everything with a single agent. Some agents may rely on local, open-weight LLMs, while others may use paid services. While we have previously discussed hybridity between different clouds, this will also be reflected at the agent level.

Over time, AI agents in companies will multiply, and pioneers like OpenClaw may evolve or even be replaced by more robust solutions... but that is the way things are going, and I encourage you, as soon as possible, to embrace this new approach and accept the change, because while we may fear for our jobs, we can also imagine new perspectives and a renewal of our profession.