Sreenath Sasidharan
01/30/2025, 4:52 PMRunLLM
01/30/2025, 4:52 PMtls_trust_certs_file_path parameter. This ensures that the client can verify the server's certificate.
3. Allow Insecure Connections (if necessary): If you are in a development environment and want to bypass certificate verification, you can set tls_allow_insecure_connection to True. However, this is not recommended for production environments.
4. Verify Certificate Paths: Double-check the paths to your certificate files in the Kubernetes secret and ensure they match the paths specified in your Pulsar client configuration.
For more detailed guidance, you can refer to the Pulsar documentation on configuring TLS for clients.
Would you like more detailed instructions on any of these steps?
Sources:
- Pulsar documentation on configuring TLS for clients 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.Sreenath Sasidharan
01/30/2025, 4:54 PMConfigure TLS CertificatesSreenath Sasidharan
01/30/2025, 4:55 PMConfigure TLS CertificatesRunLLM
01/30/2025, 4:55 PMkubectl create secret generic pulsar-tls-certificates \
--from-file=ca.cert.pem=/path/to/ca.cert.pem \
--from-file=client.cert.pem=/path/to/client.cert.pem \
--from-file=client.key-pk8.pem=/path/to/client.key-pk8.pem
- Replace /path/to/ with the actual paths to your certificate files.
3. Mount the Secret in the Function Pod:
- Modify your function's deployment configuration to mount the secret as a volume. This makes the certificates available to your function at runtime.
- Add the following volume and volumeMounts configuration to your function's pod specification:
volumes:
- name: tls-certificates
secret:
secretName: pulsar-tls-certificates
volumeMounts:
- mountPath: /etc/tls
name: tls-certificates
readOnly: true
- Ensure that the mountPath matches the path you will use in your Pulsar client configuration.
4. Configure the Pulsar Client:
- In your Python function, configure the Pulsar client to use the mounted certificates. Specify the path to the CA certificate using the tls_trust_certs_file_path parameter.
- Example:
from pulsar import Client
client = Client(
'pulsar+ssl://broker.example.com:6651',
tls_trust_certs_file_path='/etc/tls/ca.cert.pem',
tls_allow_insecure_connection=False
)
By following these steps, you ensure that your Pulsar function can securely communicate with the Pulsar broker using TLS.
Sources:
- Pulsar documentation on creating admin certificates
- Pulsar documentation on configuring TLS for clients 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.Sreenath Sasidharan
01/30/2025, 4:57 PMRunLLM
01/30/2025, 4:57 PMvalues.yaml file and reference it in your function configuration.
2. Create Kubernetes Secrets:
- Create a Kubernetes secret to store your sensitive data. Use the following command to create a secret:
kubectl create secret generic my-function-secrets \
--from-literal=DATABASE_PASSWORD=mysecretpassword
- Replace mysecretpassword with your actual secret value.
3. Configure Function to Use Secrets:
- When deploying the function via the REST API, ensure that the function configuration includes the secrets. You can specify secrets in the function configuration using the secrets field.
- Example JSON payload for the REST API:
{
"tenant": "mytenant",
"namespace": "mynamespace",
"name": "myfunction",
"inputs": [
"persistent://mytenant/mynamespace/myfuncinput"
],
"className": "com.company.pulsar.myfunction",
"secrets": {
"DATABASE_PASSWORD": {
"path": "my-function-secrets",
"key": "DATABASE_PASSWORD"
}
}
}
- This configuration tells the function to use the DATABASE_PASSWORD from the my-function-secrets Kubernetes secret.
4. Update REST API Call:
- Ensure that your REST API call includes the updated function configuration with the secrets. You can use tools like curl or Postman to make the API call with the JSON payload.
By following these steps, you can ensure that your Pulsar function pod has access to the necessary secrets when deployed via the REST API.
Would you like more detailed instructions on any of these steps?
Sources:
- Configure Kubernetes runtime
- Enable security on functions 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.