# Day 35: Mastering ConfigMaps and Secrets in Kubernetes

Today, let's dive into Secrets and ConfigMaps in Kubernetes. These tools help us manage sensitive information and configuration settings securely. Let's get started!

Task 1: Creating a Secret

Secrets protect sensitive data like passwords and API keys. In our project, we'll create a secret to store our credentials. Here's how:

1. Prepare your sensitive data in a file.
    
2. Create a secret using the command:
    

```bash
kubectl create secret generic my-secret --from-file=my-credentials.txt
```

Task 2: Creating a ConfigMap

ConfigMaps hold application configuration settings. In our project, we'll create a ConfigMap for our custom settings. Follow these steps:

1. Prepare your configuration settings in a file.
    
2. Create a ConfigMap using the command:
    

```bash
kubectl create configmap my-config --from-file=my-settings.conf
```

Task 3: Using Secrets and ConfigMaps in Deployments

Now, let's leverage the Secrets and ConfigMaps in our deployments. Here's an example YAML file:

```bash
apiVersion: apps/v1
kind: Deployment
metadata:
  name: node-app
spec:
  replicas: 5
  selector:
    matchLabels:
      app: node-app
  template:
    metadata:
      labels:
        app: node-app
    spec:
      containers:
      - name: node-app
        image: patelajay745/node-app-new:latest
        ports:
        - containerPort: 3000
        env:
        - name: MY_SECRET
          valueFrom:
            secretKeyRef:
              name: my-secret
              key: my-credentials.txt
        - name: MY_CONFIG
          valueFrom:
            configMapKeyRef:
              name: my-config
              key: my-settings.conf
```

By using Secrets and ConfigMaps in our deployments, we ensure secure access to sensitive data and smooth configuration management.

That's it for today's challenge! If you have any questions or suggestions, feel free to leave a comment. Keep exploring Kubernetes and enhancing your DevOps skills!

#Kubernetes #DevOps #Secrets #ConfigMaps #Deployment #LearningInProgress #TechCommunity #KeepLearning
