Commands related to Kubernetes Secrets

Enter the command to create a Secrets using –from-literal flag:

kubectl create secret generic [NAME] --from-literal=username=myName --from-literal=password=myPassword


Enter the command to creating a Secret from a configuration file:

kubectl apply -f [SECRET_FILE_NAME]


Enter the command to get the list of Secrets in the cluster:

kubectl get secrets


Enter the command to get additional information about a Secret:

kubectl describe secret [NAME]


Enter the command to delete a Secret:

kubectl delete secret [NAME]


How To Use Kubernetes Secrets As Files In Containers ?

Secrets are Objects in Kubernetes that are used to store the data and credentials that we would not want to share with others. Secret is a Kubernetes component just like Configmap but the difference is that it’s used to store secret data credentials and it stores this data not a plain text format but in base64 encoded format. In this article, we will see a brief introduction to Kubernetes Secrets and a tutorial on How to use Kubernetes Secrets as files in containers.

Similar Reads

Kubernetes Secrets

A Secret is a Kubernetes Object used to store sensitive data such as passwords, tokens, keys, etc. which we would not want anyone else to access. Using a Secret ensures that we are not including any confidential data in our application code. Secret is a Kubernetes component just like Configmap but the difference is that it’s used to store secret data credentials and it stores this data not a plain text format but in base64 encoded format....

Why do we need Secrets?

Role of Secret is similar to that of a Configmap, like Config Map usually contains configuration data like URLs of database or URLs of some other services, Secret is used to store the data and credentials that we would not want to share with others....

Tutorial – How to use Kubernetes Secret as file

In this tutorial we will see how to use Secrets as files within the containers....

Commands related to Kubernetes Secrets

Enter the command to create a Secrets using –from-literal flag:...

Conclusion

A Secret is a Kubernetes Object used to store sensitive data such as passwords, tokens, keys, etc. which we would not want anyone else to access. Using a Secret ensures that we are not including any confidential data in our application code. Role of Secret is similar to that of a Configmap, like Config Map usually contains configuration data like URLs of database or URLs of some other services, Secret is used to store the data and credentials that we would not want to share with others. We hope that this article taught you about How to use Kubernetes secrets as files in containers. Make sure to follow other articles on GeeksforGeeks to know about more tools in DevOps....

Kubernetes Secrets – FAQ’s

What is the difference between Secret and Config Map?...