Creating Your Own Kubernetes App as a Polycrate Block: A Step-by-Step Guide
TL;DR In this post, you’ll create a complete Polycrate block for your own Kubernetes app – …
Diese Serie zeigt Schritt für Schritt, wie Ansible mit Polycrate zu einer strukturierten, teilbaren und compliance-fähigen Automatisierungsplattform wird – von den Grundlagen bis zu Enterprise-Szenarien.
polycrate mcp) gives AI clients Hub, docs, and schema tools—execution stays in your CLI; see the MCP documentation.Polycrate was created as a pragmatic response to a well-known problem: Ansible is powerful, but the surrounding setup can be cumbersome. Python versions, local setups, playbook sprawl, lack of structure, compliance approvals—all of these consume time.
With Polycrate, Ansible is containerized and gets a framework:
age ensures simple, built-in security.What was more implicit in this article series: Polycrate is not just a tool, but an ecosystem. It includes:
polycrate mcp (stdio) to query Hub, docs, and schemas—see MCP documentationLet’s take a closer look at these components—and what they mean for Linux admins, Windows teams, IoT environments, and enterprise architects.
PolyHub is the OCI-based registry for Polycrate blocks. Technically, blocks are versioned and published like container images; practically, it feels like an app store for automation:
At hub.polycrate.io, you can filter blocks, such as:
infra/linux-* for Linux servers (patch management, hardening)infra/windows-* for Windows servers, AD, GPOk8s/* for Kubernetes clusters, ingress, monitoringsecurity/* for CIS benchmarks, audit logging, compliance checksEach block is:
:0.4.2—never use :latest)An example of a workspace definition that combines a block from PolyHub and a local block:
# workspace.poly
name: acme-corp-automation
organization: acme
blocks:
- name: linux-patching
from: registry.acme-corp.com/acme/infra/linux-patching:0.4.2
config:
target_hosts: "linux_all"
- name: custom-hardening
from: custom-hardening
config:
profile: "cis_level1"The YAML inventory is located in the workspace root as inventory.yml, as described in the workspace documentation:
# inventory.yml
all:
children:
linux_all:
hosts:
server01.acme-corp.com:
ansible_user: ubuntu
server02.acme-corp.com:
ansible_user: ubuntuThe local block custom-hardening might look like this:
# blocks/custom-hardening/block.poly
name: custom-hardening
version: 0.1.0
kind: generic
config:
profile: "cis_level1"
actions:
- name: apply
description: "Apply hardening profile"
playbook: hardening.ymlAnd the corresponding Ansible playbook:
# blocks/custom-hardening/hardening.yml
---
- name: Apply custom hardening profile
hosts: all
become: true
vars:
hardening_profile: "{{ block.config.profile }}"
tasks:
- name: Ensure auditd is installed
ansible.builtin.package:
name: auditd
state: present
- name: Ensure minimal password length
ansible.builtin.lineinfile:
path: /etc/pam.d/common-password
regexp: '^password\s+requisite\s+pam_pwquality\.so'
line: 'password requisite pam_pwquality.so retry=3 minlen=14'The whole setup is executed as usual in the container:
polycrate run custom-hardening applyDependencies (Ansible, Python, modules like ansible.builtin.*) are included in the Polycrate container. You don’t need to install Ansible or Python locally—this elegantly and reproducibly solves the classic dependency problem.
With plain Ansible, you would:
ansible.cfg, Python versions, and collectionsWith Polycrate, the same content is packaged into a block, with clear structure and guardrails. More on this in the Ansible integration and best practices.
The Polycrate API platform complements the CLI with a central view. It is the entry point to an automatable control plane:
Typical use cases:
polycrate run … executions can be submitted as action runs (configurable, e.g. submit_action_runs)—a central work/audit trail per workspace instead of only scattered terminal history; see Polycrate API and Audit & ComplianceThis is particularly interesting for compliance officers: On May 25, 2018, the GDPR came into force—since then, accesses, changes, and data flows must be traceable. The Polycrate API provides structured data on automation processes without you having to laboriously aggregate your own logs.
Technical details can be found in the Polycrate documentation, especially Polycrate API, registry, workspaces, and the CLI.
MCP is the Model Context Protocol—not “Multi Control Plane.” The CLI exposes an MCP endpoint via polycrate mcp over stdio (JSON-RPC). Cursor, Claude Desktop, or VS Code / Copilot launch this process on demand as a subprocess—you do not need a long-running service in your project folder.
What Polycrate MCP actually provides (examples):
hub_list_blocks, hub_inspect_block, …): find and inspect blocks on the Hubdocs_get: selected Polycrate documentation pagesspec_workspace, spec_block, …): correct structure for workspace.poly / block.poly, etc.MCP does not automatically mirror local files like inventory.yml or playbooks—use the IDE (project context) together with these tools. Details and client configuration: MCP Server Integration.
This enables workflows such as:
workspace.poly drafts without copy-paste from stale examplespolycrate run on your sideImportant: MCP does not replace compliance rules. The block model, workspaces, and workspace encryption remain the guardrails—whether or not an AI suggests configuration.
Polycrate sees itself as European, openly documented tooling. This is also reflected in the handling of blocks:
The path to a community block:
blocks/ (block.poly + playbooks, templates)version: 0.1.0, 0.2.0, …)cargo.ayedo.cloud)—see registry documentationWorkspace encryption is a plus: You can encrypt sensitive configuration (passwords, API keys, kubeconfigs) in the workspace with age without having to set up external systems like Vault:
polycrate workspace encryptMore on this in the workspace encryption documentation.
ayedo is not only the initiator and maintainer of Polycrate but also supports companies operationally:
The strength: The team works daily with Ansible, Kubernetes, and traditional infrastructure. The solutions are practical—from “How do we structure our workspaces?” to “How do we integrate Polycrate into our existing ticketing and monitoring system?”.
In 25 articles, we have looked at Polycrate from various perspectives:
Recurring patterns:
polycrate run BLOCK ACTION) lowers the entry barrier—even for less technical colleagues.Concrete starting points:
acme-corp-automation).Technically: follow the workspace guide and Ansible integration, wire SSH hosts per the SSH documentation, and start with a standard block from PolyHub.
Concrete starting points:
Windows modules (ansible.windows.*) run in the container—you do not manage them on the admin laptop. See Ansible integration.
Concrete starting points:
Use the API platform to make runs and compliance-relevant events visible centrally, and develop a block catalog with your teams. Workspaces, registry, and workspace encryption are especially relevant.
Concrete starting points:
Because Polycrate runs in the container, you can use the same setup from dev workstations to CI/CD without reinstalling per environment. Best practices help structure edge blocks.
No. You can use Polycrate purely via the CLI and reference blocks from PolyHub in workspace.poly. The API platform becomes interesting when:
To get started, a workspace, a few blocks, and inventory.yml locally are enough. You can add the API later without throwing away existing workspaces.
Polycrate uses age for workspace encryption. It is lightweight, cryptographically sound, and fully integrated. You do not need a separate system like Vault to:
Vault remains right for complex secret-management estates. Where the focus is secure workspaces and auditable automation, built-in workspace encryption is often faster.
ayedo helps on several levels:
Whether you need spot support or long-term partnership—see Polycrate, Platform Engineering, and our consulting.
More questions: FAQ.
Polycrate, PolyHub, the API platform, and MCP form an ecosystem that makes automation structured, shareable, and future-proof—without losing sight of day-to-day work for Linux admins, Windows teams, or IoT specialists.
This series showed how:
polycrate run from the modelayedo supports you technically and organizationally:
The best way to judge value for your environment is a concrete demo with your requirements and real-world examples.
Overview and registration: Workshops.
TL;DR In this post, you’ll create a complete Polycrate block for your own Kubernetes app – …
TL;DR PolyHub functions like an app store for infrastructure: Ready-made ayedo blocks for Kubernetes …
TL;DR The Polycrate API transforms individual workspaces into a team platform: all workspaces, …