devspace
devspace copied to clipboard
`devspace attach` fails but can't find how to set its options tty and stdin to true
What happened?
-
I tried
devspace attach
but didn't get a terminal to the container.$ devspace attach [warn] To be able to interact with the container its options tty (currently `false`) and stdin (currently `false`) must both be `true` [info] Attaching to pod:container devspace-quickstart-golang-c85c75d9b-nl8wv-5xkqh:container-0 [info] If you don't see a command prompt, try pressing enter.
-
Where can I find steps to configure "options tty" and "stdin" to
true
as mentioned in the warning message?
What did you expect to happen instead? I expected to get access to the container through a terminal.
How can we reproduce the bug? (as minimally and precisely as possible)
devspace attach
My devspace.yaml:
I'm using the golang quickstart guide.
version: v1beta11
# `vars` specifies variables which may be used as ${VAR_NAME} in devspace.yaml
vars:
- name: IMAGE
value: dharmit/app
# `deployments` tells DevSpace how to deploy this project
deployments:
- name: devspace-quickstart-golang
# This deployment uses `helm` but you can also define `kubectl` deployments or kustomizations
helm:
# We are deploying the so-called Component Chart: https://devspace.sh/component-chart/docs
componentChart: true
# Under `values` we can define the values for this Helm chart used during `helm install/upgrade`
# You may also use `valuesFiles` to load values from files, e.g. valuesFiles: ["values.yaml"]
values:
containers:
- image: ${IMAGE} # Use the value of our `${IMAGE}` variable here (see vars above)
service:
ports:
- port: 8080
# `dev` only applies when you run `devspace dev`
dev:
# `dev.ports` specifies all ports that should be forwarded while `devspace dev` is running
# Port-forwarding lets you access your application via localhost on your local machine
ports:
- imageSelector: ${IMAGE} # Select the Pod that runs our `${IMAGE}`
forward:
- port: 8080
# `dev.open` tells DevSpace to open certain URLs as soon as they return HTTP status 200
# Since we configured port-forwarding, we can use a localhost address here to access our application
open:
- url: http://localhost:8080
# `dev.sync` configures a file sync between our Pods in k8s and your local project files
sync:
- imageSelector: ${IMAGE} # Select the Pod that runs our `${IMAGE}`
# `excludePaths` option expects an array of strings with paths that should not be synchronized between the
# local filesystem and the remote container filesystem. It uses the same syntax as `.gitignore`.
excludePaths:
- .git/
uploadExcludePaths:
- Dockerfile
# `dev.terminal` tells DevSpace to open a terminal as a last step during `devspace dev`
terminal:
imageSelector: ${IMAGE} # Select the Pod that runs our `${IMAGE}`
# With this optional `command` we can tell DevSpace to run a script when opening the terminal
# This is often useful to display help info for new users or perform initial tasks (e.g. installing dependencies)
# DevSpace has generated an example ./devspace_start.sh file in your local project - Feel free to customize it!
command:
- ./devspace_start.sh
# Since our Helm charts and manifests deployments are often optimized for production,
# DevSpace let's you swap out Pods dynamically to get a better dev environment
replacePods:
- imageSelector: ${IMAGE} # Select the Pod that runs our `${IMAGE}`
# Since the `${IMAGE}` used to start our main application pod may be distroless or not have any dev tooling, let's replace it with a dev-optimized image
# DevSpace provides a sample image here but you can use any image for your specific needs
replaceImage: loftsh/go:latest
# Besides replacing the container image, let's also apply some patches to the `spec` of our Pod
# We are overwriting `command` + `args` for the first container in our selected Pod, so it starts with `sleep 9999999`
# Using `sleep 9999999` as PID 1 (instead of the regular ENTRYPOINT), allows you to start the application manually
patches:
- op: replace
path: spec.containers[0].command
value:
- sleep
- op: replace
path: spec.containers[0].args
value:
- "9999999"
- op: remove
path: spec.containers[0].securityContext
# `profiles` lets you modify the config above for different environments (e.g. dev vs production)
profiles:
# This profile is called `production` and you can use it for example using: devspace deploy -p production
# We generally recommend using the base config without any profiles as optimized for development (e.g. image build+push is disabled)
- name: production
# This profile adds our image to the config so that DevSpace will build, tag and push our image before the deployment
merge:
images:
app:
image: ${IMAGE} # Use the value of our `${IMAGE}` variable here (see vars above)
dockerfile: ./Dockerfile
Local Environment:
-
DevSpace Version: devspace version 5.18.5
-
Operating System: Linux (Fedora 35)
-
ARCH of the OS: AMD64 Kubernetes Cluster:
-
minikube
minikube version: v1.25.2 commit: 362d5fdc0a3dbee389b3d3f1034e8023e72bd3a7
-
Kubernetes Version: [use
kubectl version
]$ kubectl version Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.1", GitCommit:"86ec240af8cbd1b60bcc4c03c20da9b98005b92e", GitTreeState:"clean", BuildDate:"2021-12-16T11:41:01Z", GoVersion:"go1.17.5", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.3", GitCommit:"816c97ab8cff8a1c72eccca1026f7820e93e0d25", GitTreeState:"clean", BuildDate:"2022-01-25T21:19:12Z", GoVersion:"go1.17.6", Compiler:"gc", Platform:"linux/amd64"}
/kind bug
Hello @dharmit! You need to enable this inside the container you are deploying via:
# `deployments` tells DevSpace how to deploy this project
deployments:
- name: devspace-quickstart-golang
# This deployment uses `helm` but you can also define `kubectl` deployments or kustomizations
helm:
# We are deploying the so-called Component Chart: https://devspace.sh/component-chart/docs
componentChart: true
# Under `values` we can define the values for this Helm chart used during `helm install/upgrade`
# You may also use `valuesFiles` to load values from files, e.g. valuesFiles: ["values.yaml"]
values:
containers:
- image: ${IMAGE} # Use the value of our `${IMAGE}` variable here (see vars above)
stdin: true
tty: true
service:
ports:
- port: 8080