Learn how to use Kuba to securely run your applications with environment variables from cloud providers.
Running Commands with Kuba
The basic syntax for using Kuba is:
kuba run -- <your-command>
This will fetch all secrets defined in your kuba.yaml
file and pass them as
environment variables to your command.
Node.js Application
kuba run -- node dist/server.js
Python Application
kuba run -- python app.py
Docker Container
kuba run -- docker run myapp
Shell Script
kuba run -- ./deploy.sh
Specifying Environments
You can specify which environment configuration to use with the --env
flag:
kuba run --env development -- node app.js
kuba run --env staging -- python app.py
kuba run --env production -- docker run myapp
default
environment from your
configuration.Development Workflow
Use Kuba during development to avoid managing local .env
files:
# Start development server with secrets
kuba run --env development -- npm run dev
# Run tests with test environment secrets
kuba run --env testing -- npm test
# Run database migrations
kuba run --env development -- npm run migrate
CI/CD Integration
Integrate Kuba into your CI/CD pipelines:
# Build and test with staging secrets
kuba run --env staging -- npm run build
kuba run --env staging -- npm test
# Deploy with production secrets
kuba run --env production -- docker build -t myapp .
kuba run --env production -- docker push myapp
Docker Integration
Use Kuba with Docker containers:
# Run container with secrets as environment variables
kuba run -- docker run -e DATABASE_URL -e API_KEY myapp
# Build container with secrets available during build
kuba run -- docker build --build-arg DATABASE_URL --build-arg API_KEY .
Common Issues
Authentication Errors
Ensure your cloud provider credentials are properly configured. Check the Cloud Providers guide for setup instructions.
Configuration Errors
Validate your kuba.yaml
file. Use kuba init
to generate
a valid template.
Permission Errors
Ensure your credentials have the necessary permissions to access the secrets specified in your configuration.
Debug Mode
Enable debug mode to see detailed information about what Kuba is doing:
kuba run --debug -- node app.js
Security
- Never commit secrets to version control
- Use environment-specific configurations
- Rotate secrets regularly
- Limit access to production secrets
Configuration
- Use descriptive environment variable names
- Group related secrets with secret paths
- Leverage variable interpolation
- Document your configuration structure
Deployment
- Test configurations in staging first
- Use CI/CD for consistent deployments
- Monitor secret access and usage
- Have a rollback strategy
Development
- Use local development environments
- Share configuration templates, not secrets
- Test with different cloud providers
- Keep configurations in sync across teams
Cloud Providers
Set up authentication and permissions for your cloud providers.
Cloud Providers Guide