← Back to Skills Marketplace
jokerzeng

K8s Yaml Connect

by JokerZeng · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
112
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install k8s-yaml-connect
Description
Connect to Kubernetes clusters using YAML configuration files. Use when you need to apply, validate, or manage Kubernetes resources via kubectl with YAML inp...
README (SKILL.md)

Kubernetes YAML Connect Skill

This skill enables connection to Kubernetes clusters using YAML configuration files as input. It provides tools to apply, validate, and manage Kubernetes resources through kubectl commands.

When to Use

Use this skill when:

  • You have Kubernetes YAML configuration files that need to be applied to a cluster
  • You need to validate YAML syntax before deployment
  • You want to create or update kubeconfig from YAML input
  • You need to switch between Kubernetes contexts
  • You want to check cluster status and resources

Prerequisites

Required

  • kubectl must be installed and available in PATH
  • Kubernetes cluster accessible (local or remote)
  • Appropriate permissions for the target cluster

Installing kubectl

If kubectl is not installed, you can install it using:

macOS:

# Using Homebrew
brew install kubectl

# Or download directly
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/

Linux:

# Using package manager (Ubuntu/Debian)
sudo apt-get update
sudo apt-get install -y kubectl

# Or download directly
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/

Windows:

# Using Chocolatey
choco install kubernetes-cli

# Or download from official release

Verify installation:

kubectl version --client

Core Workflow

1. Validate YAML Syntax

Before applying any YAML, always validate the syntax:

kubectl apply --dry-run=client -f - \x3C\x3C'EOF'
[YAML_CONTENT]
EOF

2. Apply YAML to Cluster

Apply validated YAML to the current context:

kubectl apply -f - \x3C\x3C'EOF'
[YAML_CONTENT]
EOF

3. Create/Update Kubeconfig from YAML

If you have kubeconfig YAML, save it and update context:

# Save kubeconfig
cat > /tmp/kubeconfig.yaml \x3C\x3C'EOF'
[KUBECONFIG_YAML]
EOF

# Set KUBECONFIG environment variable
export KUBECONFIG=/tmp/kubeconfig.yaml

# Verify connection
kubectl cluster-info

4. Context Management

List and switch contexts:

# List available contexts
kubectl config get-contexts

# Switch to specific context
kubectl config use-context [CONTEXT_NAME]

# Get current context
kubectl config current-context

Common Operations

Deploy a Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80

Create a Service

apiVersion: v1
kind: Service
metadata:
  name: nginx-service
spec:
  selector:
    app: nginx
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
  type: LoadBalancer

Create a ConfigMap

apiVersion: v1
kind: ConfigMap
metadata:
  name: app-config
data:
  APP_ENV: "production"
  LOG_LEVEL: "info"

Error Handling

Check for Common Issues

# Check if kubectl is installed
command -v kubectl

# Check cluster connectivity
kubectl version --short

# Check if context is set
kubectl config view --minify

Validate YAML Before Applying

Always use dry-run first to catch errors:

kubectl apply --dry-run=client -f [FILE_OR_STDIN]

Security Considerations

  1. Never commit sensitive data in YAML files (use Secrets or external config)
  2. Validate YAML from untrusted sources before applying
  3. Use namespaces to isolate resources
  4. Apply least privilege RBAC permissions

Examples

Example 1: Apply Simple Deployment

# YAML content as variable
YAML_CONTENT=$(cat \x3C\x3C'EOF'
apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: test
  template:
    metadata:
      labels:
        app: test
    spec:
      containers:
      - name: test
        image: nginx:alpine
EOF
)

# Apply to cluster
kubectl apply -f - \x3C\x3C\x3C "$YAML_CONTENT"

Example 2: Multi-resource YAML

kubectl apply -f - \x3C\x3C'EOF'
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: app-config
data:
  key: value
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: app-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
      - name: app
        image: myapp:latest
        envFrom:
        - configMapRef:
            name: app-config
EOF

References

For more detailed information, see:

Troubleshooting

Common Issues

  1. Connection refused: Check if cluster is running and accessible
  2. Unauthorized: Verify kubeconfig and permissions
  3. YAML syntax error: Validate YAML with kubectl apply --dry-run
  4. Resource already exists: Use kubectl apply for updates or kubectl replace for forced updates

Debug Commands

# Get detailed error information
kubectl describe [RESOURCE_TYPE] [RESOURCE_NAME]

# Check events
kubectl get events --sort-by='.lastTimestamp'

# Check pod logs
kubectl logs [POD_NAME]

Remember: Always test YAML in a non-production environment first when possible.

Usage Guidance
This skill appears to do what it claims, but take these precautions before using it: - Ensure kubectl is installed locally and you understand the cluster you will target. kubectl will contact whatever cluster the kubeconfig points to. - Kubeconfig files contain credentials: only provide kubeconfig YAML from trusted sources and prefer using the -t/--temp option when testing. - The scripts will create files in your home (~/.kube/...) and print commands to merge configs or export KUBECONFIG; they do not automatically update your shell profiles but will show commands that, if executed, make changes permanent. - Validate any YAML from external sources (use dry-run) to avoid applying malicious workloads to your clusters. - If you need higher assurance, inspect the scripts locally and run them in a non-production environment first.
Capability Analysis
Type: OpenClaw Skill Name: k8s-yaml-connect Version: 1.0.0 The skill provides a set of utility scripts and instructions for managing Kubernetes clusters using kubectl. It includes functionality for validating YAML manifests, applying resources to a cluster, and managing kubeconfig files (scripts/apply-yaml.sh, scripts/set-kubeconfig.sh, scripts/validate-yaml.sh). The behavior is transparent, well-documented, and aligns with the stated purpose of Kubernetes resource management without any signs of malicious intent, data exfiltration, or unauthorized persistence.
Capability Assessment
Purpose & Capability
Name/description (apply/validate/manage Kubernetes YAML and kubeconfig) align with included scripts and README. Requiring kubectl and tools like kubeval/yamllint is expected for this functionality. package.json lists kubectl as a peerDependency (informational) — reasonable though kubectl is not an npm package.
Instruction Scope
SKILL.md and scripts explicitly describe running kubectl commands, validating YAML, and creating/updating kubeconfig files. The scripts read stdin or files and call kubectl/kubeval/yamllint as needed. They do not instruct the agent to read unrelated system files or send data to external endpoints beyond normal kubectl communication with the cluster.
Install Mechanism
No automated install/download steps are included; scripts are local and instruction-only. SKILL.md gives legitimate kubectl installation examples using official release URLs/package managers (dl.k8s.io, brew, apt, choco). No arbitrary remote URLs or archive extraction performed by the skill itself.
Credentials
The skill declares no required env vars, which matches the registry metadata, but runtime use relies on KUBECONFIG and $HOME (for writing kubeconfig files). This is proportionate for kubeconfig management, but kubeconfig files can contain cluster credentials—users should avoid providing kubeconfigs from untrusted sources.
Persistence & Privilege
Scripts create files under the user's home (e.g., ~/.kube/config-<timestamp>) or temporary files and print commands to merge or export KUBECONFIG. The skill does not automatically modify shell profiles or other skills' configurations, nor is it forced to always load (always:false). Users should be aware the scripts can create/replace kubeconfig files if run with non-temp options.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install k8s-yaml-connect
  3. After installation, invoke the skill by name or use /k8s-yaml-connect
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
- Initial release of k8s-yaml-connect. - Enables connecting to Kubernetes clusters using YAML configuration files. - Supports applying, validating, and managing Kubernetes resources via kubectl with YAML input. - Handles kubeconfig creation, context switching, and resource deployment from YAML. - Includes troubleshooting steps, best practices, and security considerations.
Metadata
Slug k8s-yaml-connect
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is K8s Yaml Connect?

Connect to Kubernetes clusters using YAML configuration files. Use when you need to apply, validate, or manage Kubernetes resources via kubectl with YAML inp... It is an AI Agent Skill for Claude Code / OpenClaw, with 112 downloads so far.

How do I install K8s Yaml Connect?

Run "/install k8s-yaml-connect" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is K8s Yaml Connect free?

Yes, K8s Yaml Connect is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does K8s Yaml Connect support?

K8s Yaml Connect is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created K8s Yaml Connect?

It is built and maintained by JokerZeng (@jokerzeng); the current version is v1.0.0.

💬 Comments