How to include "readonly" and selinux context ":z" in kubernetes pod definition ?

Solution Unverified - Updated -

Issue

  • How to include "readonly" and selinux context ":z" in kubernetes pod definition ?

Snip from the pod definition

volumeMounts:
      - name: storage
        mountPath: /storage
      - name: secret
        readOnly: true
        mountPath: /secret:z                 

While deploying the pod, following message is seen in the logs

Mar 24 17:01:22 XXXXX docker[2242]: time="2016-03-24T17:01:22.895864834Z" level=error msg="Handler for POST /containers/{name:.*}/start returned error: Invalid volume specification: /var/lib/kubelet/pods/17182cf7-f1d5-11e5-8219-5254006f3eb2/volumes/kubernetes.io~secret/secret:/secret:z:ro"

Environment

  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Atomic Host 7
  • Kubernetes 1.2

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.