5.2 KiB
name, description, user-invocable
| name | description | user-invocable |
|---|---|---|
| dot-ai-port-destroy | Remove all Port integrations, Kubernetes resources, and local files created by /port-setup | true |
Destroy Port Integrations
Remove all Port integrations, Kubernetes resources, and local files created by /port-setup.
Prerequisites
Check the following and instruct the user to install/configure if missing:
- kubectl - installed and configured with cluster access
- helm - installed
- gh - GitHub CLI installed and authenticated
- Environment variables set:
PORT_CLIENT_IDPORT_CLIENT_SECRET
General Guidelines
- Confirm with user before proceeding with deletion
- Order matters - stop syncing FIRST, then delete Port resources
- Check existence before attempting deletion to avoid errors
- Consult Port MCP tools to discover what was created
- User actions vs automated: Some steps require user action (marked with "User action required") - present these as instructions, then STOP and wait for user confirmation before proceeding to the next step.
Step 0: Discover Environment
Before destroying, discover what exists and how it was deployed:
- GitOps Tool: Check for ArgoCD (
argocdnamespace) or Flux (flux-systemnamespace) - Manifest directory: Check for Port-related manifests (e.g.,
apps/port-*.yaml) - Port resources: Use Port MCP tools to list blueprints, entities, actions, integrations
- GitHub resources: Check for workflows (
.github/workflows/port-*.yaml) and repository secrets
GitOps Workflow Rules
IMPORTANT: When ArgoCD or Flux is detected, deletions must go through Git first.
- Delete manifests from Git - Remove the YAML files from the manifest directory
- Commit and push - The GitOps tool will detect changes and delete resources automatically
- Wait for sync - Verify the resources are deleted before proceeding to Port cleanup
- Then delete Port resources - Only after syncing stops, delete blueprints/entities/actions
This order ensures the exporter stops syncing before you delete resources in Port.
Part 1: Delete Kubernetes Resources (FIRST - stops syncing)
Critical: Delete the K8s exporter FIRST to stop new entities from being synced to Port.
Uninstall Port K8s Exporter
Check deployment method and delete accordingly:
With ArgoCD/Flux (GitOps):
- Delete the manifest file from Git:
rm <manifest-dir>/port-k8s-exporter.yaml
git add -A && git commit -m "Remove port-k8s-exporter" && git push
- Wait for ArgoCD/Flux to sync and delete the resources
- Verify:
kubectl get ns port-k8s-exportershould return not found - If namespace still exists after sync, delete it manually:
kubectl delete ns port-k8s-exporter
With Helm directly (non-GitOps):
helm uninstall port-k8s-exporter -n port-k8s-exporter
kubectl delete secret port-credentials -n port-k8s-exporter
kubectl delete externalsecret port-credentials -n port-k8s-exporter # if using ESO
kubectl delete namespace port-k8s-exporter
Part 2: Delete Port Self-Service Actions
Delete all self-service actions created for CRDs. Do this BEFORE deleting blueprints since actions reference blueprints.
- Use
mcp__port-vscode-eu__list_actionsto find actions with identifiers matching patterns:create_*,update_*,delete_*
- For each action, use
mcp__port-vscode-eu__delete_action
Part 3: Delete Port Blueprints and Entities (User Action Required)
Delete the blueprints created during setup from the Data Model page.
Steps:
- Use
mcp__port-vscode-eu__list_blueprintsto discover which blueprints exist - Identify blueprints that were created by
/port-setup(exclude system blueprints starting with_and the defaults:cluster,namespace,workload) - Present the list to the user
- Instruct the user to:
- Go to Data Model
- Tip: Switch to Cards view (top-right toggle) to make it easier to find and delete blueprints
- For each blueprint, click the "..." menu -> Delete All [Blueprint Name]
- This deletes all entities AND the blueprint in one action
STOP and wait for user confirmation before proceeding.
Part 4: Delete GitHub Workflows and Secrets
Delete Workflow Files
Look for Port-related workflows and delete them:
rm .github/workflows/port-*.yaml
Delete Repository Secrets
gh secret delete PORT_CLIENT_ID
gh secret delete PORT_CLIENT_SECRET
gh secret delete KUBE_CONFIG # if created
Commit and push the deletions:
git add -A && git commit -m "Remove Port self-service workflows" && git push
Part 5: Delete GitHub Integration Mapping (Optional)
If user wants to remove GitHub integration:
- Go to Port Data Sources: https://app.port.io/settings/data-sources
- Find the GitHub integration
- Either:
- Remove specific resource mappings (User action required)
- Or uninstall the entire GitHub App (User action required)
Verification
After cleanup, verify:
- Kubernetes:
kubectl get ns port-k8s-exporterreturns not found - Port: No custom blueprints, entities, or actions remain
- GitHub: No Port-related workflows or secrets
- Local: No Port manifests in the repository