In Kubernetes, Mounts refer to the process of connecting and making data or storage available to applications running within the system. Imagine it as providing a folder or a shared space where these applications can access and store their data.

Truefoundry allows data to be mounted in three different ways:

  • String Mount: This method involves connecting data by specifying it directly as a string within the configuration. It's suitable for smaller pieces of data.
  • Secret Mount: Secret Mount involves securely connecting sensitive information, such as passwords or API keys, to your applications. These are done using Secrets
  • Volume Mount: Volume Mount is used to connect persistent storage to applications. It enables them to access and manipulate data as needed.

Attaching a Mount

You can attach mount to your deployment in the following ways, depending on how you are creating your deployment:

  • via User Interface
  • via Python SDK
  • via YAML

Via User Interface (UI)

  1. In the Deployment Form locate the Show advanced fields toggle button at the very bottom.

  1. Now you will be able to the see the Mounts Section, enable this by clicking on the toggle
  1. Click on Add Mount Path
  1. Enter the Mount Path (File path at which file is to be mounted), and select the type of the Mount you want to attach to your deployment from the Select Data Type Dropdown
  2. Enter Data Type specific configuration
    1. String: Here you need to add the string data in the text box
    2. Secret: Enter the Secret FQN of the Secret you want to attach.
    3. Volume: Enter the Volume FQN of the Volume you want to attach.

Via Python SDK

  1. In the Deployment Form locate the Show advanced fields toggle button at the very bottom.

  1. Now you will be able to the see the Mounts Section, enable this by clicking on the toggle
  1. Click on Add Mount Path
  1. Enter the Mount Path (File path at which file is to be mounted), and select the type of the Mount you want to attach to your deployment from the Select Data Type Dropdown
  2. Enter Data Type specific configuration
    1. String: Here you need to add the string data in the text box
    2. Secret: Enter the Secret FQN of the Secret you want to attach.
    3. Volume: Enter the Volume FQN of the Volume you want to attach.

Via Python SDK

In your deployment code deploy.py, include the following:

from servicefoundry import StringDataMount
...

service = Service(
    ...
		mount = [
      StringDataMount(mount_path="/data", data="...")
		]
  	...
)

...
from servicefoundry import SecretMount
...

service = Service(
    ...
		mount = [
      SecretMount(mount_path="/data", secret_fqn="<your secret fqn>") 
		]
  	...
)

...
from servicefoundry import VolumeMount
...

service = Service(
    ...
    mount=[
      VolumeMount(mount_path="/data", volume_fqn="<your volume fqn>") 
    ]
  	...
)

...

Via CLI

In your deployment code servicefoundry.yaml, include the following:

mounts:
  - type: secret
    mount_path: /data
		data: <your data here>
mounts:
  - type: secret
    mount_path: /data
		secret_fqn: <your secret fqn>
mounts:
  - type: secret
    mount_path: /data
		volume_fqn: <your volume fqn>