ConfigMap - non confidential information Secrets - confidential information
ConfigMap
Creation through Imperative way
Create configMap Command
kubectl create cm nginx-cm --from-file=index.html
generate configmap definition file
kubectl create cm nginx-cm --from-file=index.html --dry-run=client -o yaml > configmap.yaml
Enter into pod shell
kubectl exec -it mypod --bash
Port forward
kubectl port-forward service/myservice 80:80
Secrets
Three types of secret
- docker-registry : Create a secret for use with a Docker registry
- generic : Create a secret from a local file, directory, or literal value
- tls : Create a TLS secret
Generate Secret.yaml file
kubectl create secret generic --from-literal=idli=chutney --dry-run=client -o yaml > secret.yaml
Decode secret
echo "Y2hhdG55" | base64 --decode
Expose pod external port
kubectl expose pod nginx-secret --port=80 -o yaml --dry-run=client > svc.yaml
Tommorrow: