kubernetesvimnano

I am not able to run vim or nano command to change the content of a file inside POD file system also bash-4.2 is prompted


I am trying to exec into POD running over K8S using below command,

kubectl exec -it entry-log -n my-ns  -- /bin/bash

I am able to inside POD file system and wanted to edit the file log.conf using either nano or vim commands, but nothing is available here? Also I am seeing it's prompt as bash-4.2.

bash-4.2$ cd code/
bash-4.2$ nano log.conf
bash: nano: command not found

How can I edit the said file, please suggest. Thanks!


Solution

  • What is the image of your container?

    If your image is ubuntu:focal or ubuntu:jammy, they don't have the commands like nano or vim by default. You should install these either to your Dockerfile for your image or to your container using:

    apt-get update && apt-get install nano -y