Usage Guide¶
This guide covers all the operations available in the Kubeseal VSCode extension.
Typical Workflow¶
Here's a recommended workflow for managing secrets:
- Prepare your secret -- Create a Kubernetes Secret YAML file with plain text values
- Encode values (optional) -- Use "Encode Base64 Values" if your values are in plain text
- Set up certificate -- Configure your certificate folder and select an active certificate
- Encrypt -- Use "Encrypt with Kubeseal" to create a SealedSecret
- Commit safely -- The encrypted SealedSecret can be safely committed to Git
- Deploy -- Apply the SealedSecret to your Kubernetes cluster
- Decrypt (if needed) -- Use "Decrypt Secret" to retrieve the original secret from the cluster
Encrypting Secrets¶
- Create a Kubernetes Secret YAML file
- Right-click on the file in the explorer or editor
- Select "Encrypt with Kubeseal"
- The encrypted file will be saved with a
-sealedsuffix
Example¶
Input (my-secret.yaml):
apiVersion: v1
kind: Secret
metadata:
name: my-secret
namespace: default
data:
username: YWRtaW4=
password: cGFzc3dvcmQ=
Output (my-secret-sealed.yaml):
apiVersion: bitnami.com/v1alpha1
kind: SealedSecret
metadata:
name: my-secret
namespace: default
spec:
encryptedData:
username: AgBy3i4OJSWK+PiTySYZ...
password: AgAKqjbxK9...
How encryption works
The extension uses the kubeseal CLI with the selected certificate to encrypt each value in the Secret's data field. Only the corresponding cluster's private key can decrypt the values.
Decrypting Secrets¶
- Right-click on a sealed secret YAML file
- Select "Decrypt Secret"
- The extension retrieves the actual secret from your Kubernetes cluster using
kubectl - The decrypted secret is saved with an
-unsealedsuffix
Requirements for decryption
- The SealedSecret must already be deployed to your cluster
- Your
kubectlmust be configured to access the correct cluster - You need permissions to read secrets in the target namespace
How It Works¶
The extension extracts the name and namespace from the SealedSecret YAML, then runs:
Managing Certificates¶
Setting Certificate Folder¶
Use one of these methods:
- Command Palette:
Ctrl+Shift+P→ "Set Kubeseal Certificate Folder" - VS Code Settings: Set
kubeseal.certsFolderto your certificate directory path
The folder should contain certificate files with .pem, .crt, or .cert extensions.
Selecting Active Certificate¶
- Look at the status bar at the bottom of VS Code
- Click on the certificate name (or "(not selected)" if none is active)
- Choose from the list of available certificates
- The selected certificate will be used for all encryption operations
Tip
If no certificate folder is configured, clicking the status bar item will prompt you to set one up first.
Base64 Encoding/Decoding¶
Encode Base64 Values¶
- Right-click on a Kubernetes Secret YAML file
- Select "Encode Base64 Values"
- All plain text values in the
datafield will be base64 encoded
Before:
After:
apiVersion: v1
kind: Secret
metadata:
name: my-secret
data:
username: YWRtaW4=
password: cGFzc3dvcmQxMjM=
Decode Base64 Values¶
- Right-click on a Kubernetes Secret YAML file
- Select "Decode Base64 Values"
- All base64 encoded values in the
datafield will be decoded to plain text
Note
The extension automatically detects which values are already encoded or decoded and skips them to prevent double encoding/decoding. Binary data is preserved as base64 during decoding.
Compare with the CLI¶
Every action the extension runs is a thin wrapper around the same kubeseal/kubectl commands you'd type by hand — nothing hidden. Run the equivalent command yourself in a terminal to see exactly what the extension does and confirm the output matches:
| Extension action | Equivalent CLI command |
|---|---|
| Encrypt with Kubeseal | kubeseal --cert <your-cert.pem> --format yaml < my-secret.yaml > my-secret-sealed.yaml |
| Decrypt Secret (from cluster) | kubectl get secret <name> -n <namespace> -o yaml > my-secret-unsealed.yaml |
| View Tab → list namespaces | kubectl get ns -o jsonpath='{.items[*].metadata.name}' |
| View Tab → list secrets | kubectl get secrets -n <namespace> -o jsonpath='{.items[*].metadata.name}' |
| Encode/Decode Base64 Values | Node's Buffer — equivalent to echo -n '<value>' \| base64 / echo '<value>' \| base64 -d, but run in-process (no external base64 binary, so it works on Windows too) |
Since the extension shells out to the exact same kubeseal/kubectl binaries on your PATH (via spawn(), never a shell string), the output of the CLI command and the extension action should always be identical — useful for verifying trust in the tool or debugging a mismatch.