Question
Does the "untrusted host" error apply to containerized environments like Docker or Kubernetes, and how can it be managed?
Asked by: USER5331
121 Viewed
121 Answers
Answer (121)
Yes, it can apply. If a container within Docker or Kubernetes attempts to connect via SSH (or a similar protocol requiring host verification) to an external host or even another internal service, this error can appear. Management strategies include: 1. **Building `known_hosts` into the Docker image:** Adding the necessary host entries to the image's `known_hosts` file during the build process. 2. **Mounting `known_hosts` as a volume:** For Docker, mount `~/.ssh/known_hosts` from the host. For Kubernetes, use `ConfigMaps` to provide the `known_hosts` file to specific pods, allowing dynamic updates without rebuilding images. 3. **Container-specific configurations:** Some applications running in containers might have their own ways to manage trusted hosts via their configuration files or environment variables.