How to avoid Helm warning due to config permissions

When a developer working on Kubernetes he/she generally forgets to secure the Kubernetes config file that contains the cluster tokens of environments that can be sensitive. So if you are seeing the below warning from helm chart you are one of them:-

WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /home/mukesh/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /home/mukesh/.kube/config

Reason for the above warning: Your ~/.kube/config should only be readable by you. Use chmod to change the file’s read/write permissions. Check the group permissions by running below command:-

mukesh@CXS-MukeshK:pgadmin$ ls -al ~/.kube/config
-rw-r--r-- 1 mukesh mukesh 53732 Jan  6 16:02 /home/mukesh/.kube/config

Now change the permission and check again:-

chmod go-r ~/.kube/config
mukesh@CXS-MukeshK:oepgadmin$ ls -al ~/.kube/config
-rw------- 1 mukesh mukesh 53732 Jan  6 16:02 /home/mukesh/.kube/config

Warning resolved successfully… Have Fun!