Last updated: March 15, 2026

apiVersion: external-secrets.io/v1beta1 kind: ExternalSecret metadata: name: database-credentials spec: refreshInterval: 1h secretStoreRef: name: onepassword-store kind: ClusterSecretStore target: name: db-credentials creationPolicy: Owner data:

This approach automatically synchronizes secrets from 1Password into Kubernetes, refreshing them periodically without manual intervention.

Step 5 - GitLab CI/CD Implementation

GitLab CI/CD integrates smoothly with 1Password using the service account token:

stages:
 - build
 - deploy

variables:
 OP_SERVICE_ACCOUNT_TOKEN: $OP_SERVICE_ACCOUNT_TOKEN

before_script:
 - |
 if ! command -v op &> /dev/null; then
 curl -sSf https://app-updates.agilebits.com/product_history/CLI2 | \
 grep -E "op_.*\.pkg" | head -1 | \
 awk -F'{print $4}' | \
 xargs -I {} brew install {}
 fi
 echo "$OP_SERVICE_ACCOUNT_TOKEN" | op signin --stdin

build:
 stage: build
 script:
 - echo "DB_PASSWORD=$(op item get ProductionDB --field password)" >> .env
 - echo "API_KEY=$(op item get ExternalAPI --field key)" >> .env
 - docker build --build-arg DB_PASSWORD="$(op item get ProductionDB --field password)" .
 artifacts:
 paths:
 - .env
 expire_in: 1 hour

deploy:
 stage: deploy
 script:
 - |
 export DEPLOY_KEY="$(op item get DeployKey --field private_key)"
 echo "$DEPLOY_KEY" > deploy_key
 chmod 600 deploy_key
 ssh -i deploy_key deploy@production.example.com "./deploy.sh"

This configuration installs the 1Password CLI in the job, authenticates using the service account token, retrieves secrets as needed, and uses them within each job without persisting them to logs or artifacts.

Production Considerations

When implementing 1Password automation at scale, several practices improve security and reliability.

Session management matters in long-running processes. The CLI caches credentials temporarily, for extended automation workflows, periodically refresh the session:

Check session validity
op account get || op signin --stdin < /dev/null

Network security becomes critical when transmitting credentials between systems. Always use TLS and avoid logging secret values:

Wrong - exposes password in process list
export PASSWORD=$(op item get "Item" --field password)
echo $PASSWORD # Never do this

Correct - suppress command output
export PASSWORD=$(op item get "Item" --field password 2>/dev/null)

Access auditing provides visibility into which automation systems accessed which secrets. Review the 1Password audit logs regularly to identify unusual access patterns or unauthorized attempts.

Troubleshooting

Configuration changes not taking effect

Restart the relevant service or application after making changes. Some settings require a full system reboot. Verify the configuration file path is correct and the syntax is valid.

Permission denied errors

Run the command with sudo for system-level operations, or check that your user account has the necessary permissions. On macOS, you may need to grant terminal access in System Settings > Privacy & Security.

Connection or network-related failures

Check your internet connection and firewall settings. If using a VPN, try disconnecting temporarily to isolate the issue. Verify that the target server or service is accessible from your network.

Frequently Asked Questions

How long does it take to complete this setup?

For a straightforward setup, expect 30 minutes to 2 hours depending on your familiarity with the tools involved. Complex configurations with custom requirements may take longer. Having your credentials and environment ready before starting saves significant time.

What are the most common mistakes to avoid?

The most frequent issues are skipping prerequisite steps, using outdated package versions, and not reading error messages carefully. Follow the steps in order, verify each one works before moving on, and check the official documentation if something behaves unexpectedly.

Do I need prior experience to follow this guide?

Basic familiarity with the relevant tools and command line is helpful but not strictly required. Each step is explained with context. If you get stuck, the official documentation for each tool covers fundamentals that may fill in knowledge gaps.

Will this work with my existing CI/CD pipeline?

The core concepts apply across most CI/CD platforms, though specific syntax and configuration differ. You may need to adapt file paths, environment variable names, and trigger conditions to match your pipeline tool. The underlying workflow logic stays the same.

Where can I get help if I run into issues?

Start with the official documentation for each tool mentioned. Stack Overflow and GitHub Issues are good next steps for specific error messages. Community forums and Discord servers for the relevant tools often have active members who can help with setup problems.

Related Articles

Built by theluckystrike. More at zovo.one

Related Reading

Built by theluckystrike. More at zovo.one