Skip to main content

Environment

Kubernetes Environment Variable Secrets

You can generate an environment variable script to be ran on a Linux or Unix computer below:

# Define variables
DOCKER_USERNAME=
DOCKER_API_TOKEN=
AXIOM_DATASET=
AXIOM_ORGID=
AXIOM_TOKEN=
RABBITMQ_HOST=
RABBITMQ_PORT=
RABBITMQ_USERNAME=
RABBITMQ_PASSWORD=
DATABASE_URL=
REDIS_HOST=
REDIS_PORT=
REDIS_PASSWORD=
# Create namespaces
kubectl create ns tickers
kubectl create ns backfillers
kubectl create ns couriers
kubectl create ns scouts
kubectl create ns apis
kubectl create ns websites
kubectl create ns services
# Delete Secrets
kubectl delete secrets --all -n tickers
kubectl delete secrets --all -n backfillers
kubectl delete secrets --all -n couriers
kubectl delete secrets --all -n scouts
kubectl delete secrets --all -n apis
kubectl delete secrets --all -n websites
kubectl delete secrets --all -n services
# Axiom secrets
kubectl create secret generic axiom --from-literal=dataset=$AXIOM_DATASET --from-literal=orgId=$AXIOM_ORGID --from-literal=token=$AXIOM_TOKEN --namespace tickers
kubectl create secret generic axiom --from-literal=dataset=$AXIOM_DATASET --from-literal=orgId=$AXIOM_ORGID --from-literal=token=$AXIOM_TOKEN --namespace backfillers
kubectl create secret generic axiom --from-literal=dataset=$AXIOM_DATASET --from-literal=orgId=$AXIOM_ORGID --from-literal=token=$AXIOM_TOKEN --namespace couriers
kubectl create secret generic axiom --from-literal=dataset=$AXIOM_DATASET --from-literal=orgId=$AXIOM_ORGID --from-literal=token=$AXIOM_TOKEN --namespace scouts
kubectl create secret generic axiom --from-literal=dataset=$AXIOM_DATASET --from-literal=orgId=$AXIOM_ORGID --from-literal=token=$AXIOM_TOKEN --namespace apis
kubectl create secret generic axiom --from-literal=dataset=$AXIOM_DATASET --from-literal=orgId=$AXIOM_ORGID --from-literal=token=$AXIOM_TOKEN --namespace websites
kubectl create secret generic axiom --from-literal=dataset=$AXIOM_DATASET --from-literal=orgId=$AXIOM_ORGID --from-literal=token=$AXIOM_TOKEN --namespace services
# Dockerhub secrets
kubectl create secret docker-registry dockerhub --docker-server https://index.docker.io/v1/ --docker-username $DOCKER_USERNAME --docker-password $DOCKER_API_TOKEN --namespace tickers
kubectl create secret docker-registry dockerhub --docker-server https://index.docker.io/v1/ --docker-username $DOCKER_USERNAME --docker-password $DOCKER_API_TOKEN --namespace backfillers
kubectl create secret docker-registry dockerhub --docker-server https://index.docker.io/v1/ --docker-username $DOCKER_USERNAME --docker-password $DOCKER_API_TOKEN --namespace couriers
kubectl create secret docker-registry dockerhub --docker-server https://index.docker.io/v1/ --docker-username $DOCKER_USERNAME --docker-password $DOCKER_API_TOKEN --namespace scouts
kubectl create secret docker-registry dockerhub --docker-server https://index.docker.io/v1/ --docker-username $DOCKER_USERNAME --docker-password $DOCKER_API_TOKEN --namespace apis
kubectl create secret docker-registry dockerhub --docker-server https://index.docker.io/v1/ --docker-username $DOCKER_USERNAME --docker-password $DOCKER_API_TOKEN --namespace websites
kubectl create secret docker-registry dockerhub --docker-server https://index.docker.io/v1/ --docker-username $DOCKER_USERNAME --docker-password $DOCKER_API_TOKEN --namespace services
# Redis Secrets
kubectl create secret generic redis --from-literal=host=$REDIS_HOST --from-literal=port=$REDIS_PORT --from-literal=password=$REDIS_PASSWORD --from-literal=cacheTimeout=43200 --namespace tickers
kubectl create secret generic redis --from-literal=host=$REDIS_HOST --from-literal=port=$REDIS_PORT --from-literal=password=$REDIS_PASSWORD --from-literal=cacheTimeout=43200 --namespace backfillers
kubectl create secret generic redis --from-literal=host=$REDIS_HOST --from-literal=port=$REDIS_PORT --from-literal=password=$REDIS_PASSWORD --from-literal=cacheTimeout=43200 --namespace scouts
kubectl create secret generic redis --from-literal=host=$REDIS_HOST --from-literal=port=$REDIS_PORT --from-literal=password=$REDIS_PASSWORD --from-literal=cacheTimeout=43200 --namespace apis
kubectl create secret generic redis --from-literal=host=$REDIS_HOST --from-literal=port=$REDIS_PORT --from-literal=password=$REDIS_PASSWORD --from-literal=cacheTimeout=43200 --namespace websites
kubectl create secret generic redis --from-literal=host=$REDIS_HOST --from-literal=port=$REDIS_PORT --from-literal=password=$REDIS_PASSWORD --from-literal=cacheTimeout=43200 --namespace services
kubectl create secret generic redis --from-literal=host=$REDIS_HOST --from-literal=port=$REDIS_PORT --from-literal=password=$REDIS_PASSWORD --from-literal=cacheTimeout=43200 --namespace couriers
# RabbitMQ Secrets
kubectl create secret generic rabbitmq --from-literal=host=$RABBITMQ_HOST --from-literal=port=$RABBITMQ_PORT --from-literal=username=$RABBITMQ_USERNAME --from-literal=password=$RABBITMQ_PASSWORD --from-literal=cacheTimeout=43200 --namespace tickers
kubectl create secret generic rabbitmq --from-literal=host=$RABBITMQ_HOST --from-literal=port=$RABBITMQ_PORT --from-literal=username=$RABBITMQ_USERNAME --from-literal=password=$RABBITMQ_PASSWORD --from-literal=cacheTimeout=43200 --namespace backfillers
kubectl create secret generic rabbitmq --from-literal=host=$RABBITMQ_HOST --from-literal=port=$RABBITMQ_PORT --from-literal=username=$RABBITMQ_USERNAME --from-literal=password=$RABBITMQ_PASSWORD --from-literal=cacheTimeout=43200 --namespace scouts
kubectl create secret generic rabbitmq --from-literal=host=$RABBITMQ_HOST --from-literal=port=$RABBITMQ_PORT --from-literal=username=$RABBITMQ_USERNAME --from-literal=password=$RABBITMQ_PASSWORD --from-literal=cacheTimeout=43200 --namespace apis
kubectl create secret generic rabbitmq --from-literal=host=$RABBITMQ_HOST --from-literal=port=$RABBITMQ_PORT --from-literal=username=$RABBITMQ_USERNAME --from-literal=password=$RABBITMQ_PASSWORD --from-literal=cacheTimeout=43200 --namespace websites
kubectl create secret generic rabbitmq --from-literal=host=$RABBITMQ_HOST --from-literal=port=$RABBITMQ_PORT --from-literal=username=$RABBITMQ_USERNAME --from-literal=password=$RABBITMQ_PASSWORD --from-literal=cacheTimeout=43200 --namespace services
kubectl create secret generic rabbitmq --from-literal=host=$RABBITMQ_HOST --from-literal=port=$RABBITMQ_PORT --from-literal=username=$RABBITMQ_USERNAME --from-literal=password=$RABBITMQ_PASSWORD --from-literal=cacheTimeout=43200 --namespace couriers