configmap.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: resolv-conf
data:
  resolv.conf: |
    nameserver 1.1.1.1
    nameserver 1.0.0.1

Create configmap in namespace test
kubectl apply -f configmap.yaml -n test

Apply configmap to kubernetes pod:
rc.yaml

apiVersion: v1
kind: ReplicationController
metadata:
  labels:
    name: demo-web
  name: demo-web-controller
  namespace: test
spec:
  replicas: 2
  selector:
    name: demo-web
  template:
    metadata:
      labels:
        name: demo-web
    spec:
      containers:
      - image:  nginx
        imagePullPolicy: Always
        name: demo-web
        volumeMounts:
        - mountPath: /var/www/html/
          name: demo-web-volume
        - mountPath: /etc/resolv.conf
          name: resolv-conf
          subPath: resolv.conf
          readOnly: true
        ports:
        - containerPort: 80
          name: http-server

      volumes:
      - name: demo-web-volume
        hostPath:
          path: /var/www/html/
      - name: resolv-conf
        configMap:
          name: resolv-conf

kubectl create -f rc.yaml