<p>I use this manifest configuration to deploy a registry into 3 mode Kubernetes cluster:</p>
<pre><code>apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv1
  namespace: registry-space
spec:
  capacity:
    storage: 5Gi # specify your own size
  volumeMode: Filesystem
  persistentVolumeReclaimPolicy: Retain
  local:
    path: /opt/registry # can be any path
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - kubernetes2
  accessModes:
    - ReadWriteMany # only 1 node will read/write on the path.
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pv1-claim
  namespace: registry-space
spec: # should match specs added in the PersistenVolume
  accessModes:
    - ReadWriteMany
  volumeMode: Filesystem
  resources:
    requests:
      storage: 5Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: private-repository-k8s
  namespace: registry-space
  labels:
    app: private-repository-k8s
spec:
  replicas: 1
  selector:
    matchLabels:
      app: private-repository-k8s
  template:
    metadata:
      labels:
        app: private-repository-k8s
    spec:
      volumes:
       - name: certs-vol
         hostPath:
          path: /opt/certs
          type: Directory
       - name: task-pv-storage
         persistentVolumeClaim:
           claimName: pv1-claim # specify the PVC that you've created. PVC and Deployment must be in same namespace.
      containers:
        - image: registry:2
          name: private-repository-k8s
          imagePullPolicy: IfNotPresent
          env:
          - name: REGISTRY_HTTP_TLS_CERTIFICATE
            value: &quot;/opt/certs/registry.crt&quot;
          - name: REGISTRY_HTTP_TLS_KEY
            value: &quot;/opt/certs/registry.key&quot;
          ports:
            - containerPort: 5000
          volumeMounts:
          - name: certs-vol
            mountPath: /opt/certs
          - name: task-pv-storage
            mountPath: /opt/registry
</code></pre>
<p>I manually created directories on every node under <code>/opt/certs</code> and <code>/opt/registry</code>.</p>
<p>But when I try to deploy the manifest without hardcoded <code>nodeSelectorTerms</code> on tha control plane I get error:</p>
<pre><code>kubernetes@kubernetes1:/opt/registry$ kubectl get pods --all-namespaces
NAMESPACE        NAME                                       READY   STATUS    RESTARTS      AGE
kube-system      calico-kube-controllers-58dbc876ff-fsjd5   1/1     Running   1 (74m ago)   84m
kube-system      calico-node-5brzt                          1/1     Running   1 (73m ago)   84m
kube-system      calico-node-nph9n                          1/1     Running   1 (76m ago)   84m
kube-system      calico-node-pcd74                          1/1     Running   1 (74m ago)   84m
kube-system      calico-node-ph2ht                          1/1     Running   1 (76m ago)   84m
kube-system      coredns-565d847f94-7pswp                   1/1     Running   1 (74m ago)   105m
kube-system      coredns-565d847f94-tlrfr                   1/1     Running   1 (74m ago)   105m
kube-system      etcd-kubernetes1                           1/1     Running   2 (74m ago)   105m
kube-system      kube-apiserver-kubernetes1                 1/1     Running   2 (74m ago)   105m
kube-system      kube-controller-manager-kubernetes1        1/1     Running   2 (74m ago)   105m
kube-system      kube-proxy-4slm4                           1/1     Running   1 (76m ago)   86m
kube-system      kube-proxy-4tnx2                           1/1     Running   2 (74m ago)   105m
kube-system      kube-proxy-9dgsj                           1/1     Running   1 (73m ago)   85m
kube-system      kube-proxy-cgr44                           1/1     Running   1 (76m ago)   86m
kube-system      kube-scheduler-kubernetes1                 1/1     Running   2 (74m ago)   105m
registry-space   private-repository-k8s-6d5d954b4f-xkmj5    0/1     Pending   0             4m55s
kubernetes@kubernetes1:/opt/registry$
</code></pre>
<p>Do you know how I can let Kubernetes to decide where to deploy the pod?</p>

<p>It seems like your node has taints hence pods are not getting scheduled. Can you try using this command to remove taints from your node ?</p>
<pre><code>kubectl taint nodes  &lt;node-name&gt; node-role.kubernetes.io/master-
</code></pre>
<p>or</p>
<pre><code>kubectl taint nodes --all node-role.kubernetes.io/master-
</code></pre>
<p>To get the node name use <code>kubectl get nodes</code></p>
<p>User was able to get the pod scheduled after running below command:</p>
<pre><code>kubectl taint nodes kubernetes1 node-role.kubernetes.io/control-plane:NoSchedule-
</code></pre>
<p>Now pod is failing due to crashloopbackoff this implies the pod has been scheduled.</p>
<p>Can you please check if this pod is getting scheduled and running properly ?</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: nginx1
  namespace: test
spec:
  containers:
  - name: webserver
    image: nginx:alpine
    ports:
    - containerPort: 80
    resources:
      requests:
        memory: &quot;64Mi&quot;
        cpu: &quot;200m&quot;
      limits:
        memory: &quot;128Mi&quot;
        cpu: &quot;350m&quot;
</code></pre>
