<p>I need to provide access to the file /var/docker.sock on the Kubernetes host (actually, a GKE instance) to a container running on that host. </p>

<p>To do this I'd like to mount the directory into the container, by configuring the mount in the deployment.yaml for the container deployment.</p>

<p>How would I specify this in the deployment configuration?</p>

<p>Here is the current configuration, I have for the deployment:</p>

<pre><code>apiVersion: apps/v1beta1
 kind: Deployment
metadata:
   name: appd-sa-agent
 spec:
  replicas: 1
   template: 
     metadata:
      labels:
        run: appd-sa-agent
     spec:
      containers:
      - name: appd-sa-agent
        image: docker.io/archbungle/appd-sa-agent:latest
        ports:
        - containerPort: 443
        env:
        - name: APPD_HOST  
          value: "https://graffiti201707132327203.saas.appdynamics.com"
</code></pre>

<p>How would I specify mounting the localhost file path to a directory mountpoint on the container?</p>

<p>Thanks!
T.</p>

<p>You need to define a <a href="https://kubernetes.io/docs/concepts/storage/volumes/#hostpath" rel="nofollow noreferrer">hostPath</a> volume.</p>

<pre><code>apiVersion: apps/v1beta1
kind: Deployment
metadata:
   name: appd-sa-agent
 spec:
  replicas: 1
   template: 
     metadata:
      labels:
        run: appd-sa-agent
     spec:
      volumes:
      - name: docker-socket
        hostPath:
          path: /var/run/docker.sock
      containers:
      - name: appd-sa-agent
        image: docker.io/archbungle/appd-sa-agent:latest
        volumeMounts:
        - name: docker-socket
          mountPath: /var/run/docker.sock
        ports:
        - containerPort: 443
        env:
        - name: APPD_HOST  
          value: "https://graffiti201707132327203.saas.appdynamics.com"
</code></pre>
