kubectl create configmap app-config --from-literal=message="Hello from ConfigMap"

nano configmap-pod.yml

apiVersion: v1
kind: Pod

metadata:
  name: configmap-pod

spec:
  containers:
    - name: nginx-container
      image: nginx

      volumeMounts:
        - name: config-volume
          mountPath: /etc/config

  volumes:
    - name: config-volume
      configMap:
        name: app-config



kubectl apply -f configmap-pod.yml

kubectl exec -it configmap-pod -- ls /etc/config



Create Secret:

kubectl create secret generic app-secret --from-literal=password=mysecret


nano secret-pod.yml


apiVersion: v1
kind: Pod

metadata:
  name: secret-pod

spec:
  containers:
    - name: secret-container
      image: nginx

      env:
        - name: APP_PASSWORD
          valueFrom:
            secretKeyRef:
              name: app-secret
              key: password


kubectl apply -f secret-pod.yml

kubectl exec -it secret-pod -- printenv APP_PASSWORD



minikube addons enable ingress



kubectl create deployment webapp --image=nginx



kubectl expose deployment webapp --port=80 --type=ClusterIP



nano ingress.yml

Paste:

apiVersion: networking.k8s.io/v1
kind: Ingress

metadata:
  name: webapp-ingress

spec:
  rules:
    - host: webapp.local
      http:
        paths:
          - path: /
            pathType: Prefix

            backend:
              service:
                name: webapp
                port:
                  number: 80


kubectl apply -f ingress.yml
minikube ip
sudo nano /etc/hosts
MINIKUBE_IP webapp.local
http://webapp.local

minikube addons enable metrics-server
kubectl autoscale deployment webapp --cpu-percent=50 --min=1 --max=5
kubectl get hpa
kubectl get pods
