How can i pass in --env stage while deploying a si...
# 🌱|help-and-getting-started
b
this command fails
garden deploy --env stage my-service
and the command usage accurately describes that it's possible to either deploy a single service, or set the
--env
flag, but not both? Is there a way around this?
q
Hi @bland-wolf-59979 I just tested deploying a single service with an environment flag and was successful using our Quickstart example. I invoked
garden
with
garden deploy api --env local
. Here's a snippet of the YAML for that deploy:
Copy code
yaml
kind: Deploy
name: api
type: kubernetes
description: Deploy the vote API
dependencies: [build.api, deploy.redis]
It has two dependencies,
build.api
and
deploy.redis
so deploying this single service to
local
will first build the API container image and deploy
redis
to my cluster's namespace:
Copy code
console
kubectl get po -n vote-demo-quickstart-worldofgeese 
NAME                   READY   STATUS    RESTARTS   AGE
redis-master-0         1/1     Running   0          2m33s
api-6b8789679b-9dl94   1/1     Running   0          109s
Here's the truncated logs from that successful deploy:
Copy code
console
ℹ deploy.api                → Getting status for Deploy api (type kubernetes)...
ℹ deploy.api                → Status is 'missing', api will be deployed
ℹ build.api                 → Getting status for Build api (type container)...
ℹ deploy.redis              → Getting status for Deploy redis (type helm)...
ℹ build.api                 → Status is 'not ready', api will be built
ℹ build.api                 → Building api (type container) at version v-220e63ab33...
ℹ deploy.redis              → Status is 'missing', redis will be deployed
ℹ deploy.redis              → Deploying redis (type helm) at version v-7ec69d2162...
ℹ build.api                 → Building api:v-0ae94da799...
ℹ build.api                 → Fetching docker...
✔ build.api                 → Fetched docker 24.0.4 (took 6.9 sec)
ℹ deploy.api                → Ingress: http://api.local.demo.garden
✔ deploy.api                → Done (took 5.6 sec)