Skip to main content
Username & Password secrets store authentication credentials as a username/password pair. Use them for database connections, API authentication, SMTP servers, or any service requiring basic credentials.

Use Cases

  • Database Authentication: Store credentials for PostgreSQL, MySQL, MongoDB, etc.
  • API Authentication: Basic auth credentials for REST APIs
  • SMTP/Email Services: Credentials for email sending services
  • Legacy Systems: Connect to systems using username/password authentication
  • FTP/SFTP Access: Credentials for file transfer services

Configuration Options

FieldDescriptionRequired
usernameThe username or account identifierYes
passwordThe password or secret credentialYes
encodingHow values are encoded: plain or base64No (default: plain)
Use encoding: base64 when your credentials contain special characters that might cause parsing issues, or when you’re storing pre-encoded credentials from another system.

Create a Username & Password Secret

1

Navigate to Secrets

In the Console, navigate to Secrets and click New, or use the Create dropdown in the top-right corner and select Secret.
2

Enter basic information

Enter a Name and optional Description.
3

Select secret type

Select Username/Password as the secret type.
4

Configure credentials

Click Data in the left pane. Enter the Username and Password. If your credentials are base64 encoded, enable Base64 Decode at Runtime to decode them when accessed.
5

Create the secret

Click Create.

Injecting into Workloads

As Environment Variables

Reference the username and password separately:
env:
  - name: DB_USER
    value: "cpln://secret/db-credentials.username"
  - name: DB_PASSWORD
    value: "cpln://secret/db-credentials.password"

As Volume Files

When mounted as a volume, the secret creates two files:
volumes:
  - uri: "cpln://secret/db-credentials"
    path: /etc/credentials
This creates:
  • /etc/credentials/username containing the username
  • /etc/credentials/password containing the password

Common Patterns

PostgreSQL Connection

kind: secret
name: postgres-credentials
type: userpass
data:
  username: postgres
  password: your-secure-password
Workload environment:
env:
  - name: PGUSER
    value: "cpln://secret/postgres-credentials.username"
  - name: PGPASSWORD
    value: "cpln://secret/postgres-credentials.password"

MongoDB Connection

kind: secret
name: mongodb-credentials
type: userpass
data:
  username: mongouser
  password: your-secure-password

SMTP Credentials

kind: secret
name: smtp-credentials
type: userpass
data:
  username: apikey
  password: SG.xxxxx  # SendGrid API key

Basic Auth for APIs

kind: secret
name: api-credentials
type: userpass
data:
  username: api_client_id
  password: api_client_secret

Best Practices

Generate random passwords with sufficient length and complexity. Avoid reusing passwords across different services.
Establish a rotation schedule for credentials. Update both the secret in Control Plane and the corresponding service.
Create dedicated service accounts rather than using personal credentials. This enables better auditing and easier credential rotation.
Where possible, prefer more secure authentication methods like IAM roles, service accounts, or certificate-based auth over username/password.

Next Steps