Permission denied error while doing initcontainer

kubectl create deployment ic-deploy-nautilus --image=debian:latest --dry-run=client -o yaml > nautilus-deployment.yaml
bash: nautilus-deployment.yaml: Permission denied

In which folder are you, and as what user?
Bash is telling you here that you’re not allowed to create the nautilus-deployment.yaml file.

EDIT: the reason is probably because you’re in a system folder where only root can create files.

As per the task i have to do in Thor@jumphost
user

I have no idea which task you have to do.

But if it’s a failed task in KodeKloud Engineer, use the review system there. You can always post the link here too.

There are some applications that need to be deployed on Kubernetes cluster and these apps have some pre-requisites where some configurations need to be changed before deploying the app container. Some of these changes cannot be made inside the images so the DevOps team has come up with a solution to use init containers to perform these tasks during deployment. Below is a sample scenario that the team is going to test first.

  1. Create a Deployment named as ic-deploy-xfusion .
  2. Configure spec as replicas should be 1 , labels app should be ic-xfusion , template’s metadata lables app should be the same ic-xfusion .
  3. The initContainers should be named as ic-msg-xfusion , use image fedora , preferably with latest tag and use command '/bin/bash' , '-c' and 'echo Init Done - Welcome to xFusionCorp Industries > /ic/news' . The volume mount should be named as ic-volume-xfusion and mount path should be /ic .
  4. Main container should be named as ic-main-xfusion , use image fedora , preferably with latest tag and use command '/bin/bash' , '-c' and 'while true; do cat /ic/news; sleep 5; done' . The volume mount should be named as ic-volume-xfusion and mount path should be /ic .
  5. Volume to be named as ic-volume-xfusion and it should be an emptyDir type.

Note: The kubectl utility on jump_host has been configured to work with the kubernetes cluster.

The assignment in itself does not really aid in helping you. The review system would let us see what you did. What we need to know is which folder you were in with the Thor user, when trying to create that file.

As said before, you were probably in a folder where the Thor user was not allowed to create files.

I can’t verify that though, because I don’t know what you did.

Yeah, you’re absolutely correct. @HerrSubset
@sudheer77 Please check your present working directory by pwd command. Type pwd on the terminal then run cd command. It will change the directory to /home/thor.

Note - You should be in the thor’s home directory. → /home/thor/

If you wanna do directly then

kubectl create deployment ic-deploy-nautilus --image=debian:latest --dry-run=client -o yaml > /home/thor/nautilus-deployment.yaml