This guide will help you deploy your application to Kubernetes using Secrets, Services, and Deployments.
First, create a Secret to store sensitive information such as CLIENT_ID
and CLIENT_SECRET
.
# Generated by Copilot
apiVersion: v1
kind: Secret
metadata:
name: function-calling-extension-secret
type: Opaque
data:
# Base64 encoded CLIENT_ID
CLIENT_ID: {yourbase64Client_ID}
# Base64 encoded CLIENT_SECRET
CLIENT_SECRET: {yourbase64Client_SECRET}
Apply the Secret using the following command:
kubectl apply -f secret.yaml
Next, create a Service to expose your application.
# Generated by Copilot
apiVersion: v1
kind: Service
metadata:
name: function-calling-extension-service
spec:
type: LoadBalancer
selector:
app: function-calling-extension
ports:
- protocol: TCP
port: 80
targetPort: 8080
Apply the Service using the following command:
kubectl apply -f service.yaml
Finally, create a Deployment to manage your application's pods.
# Generated by Copilot
apiVersion: apps/v1
kind: Deployment
metadata:
name: function-calling-extension-deployment
spec:
replicas: 1
selector:
matchLabels:
app: function-calling-extension
template:
metadata:
labels:
app: function-calling-extension
spec:
containers:
- name: function-calling-extension
image: copilotx.azurecr.io/copilot/extensions/function-calling-extension:20241226
ports:
- containerPort: 8080
env:
- name: PORT
value: "8080"
- name: CLIENT_ID
valueFrom:
secretKeyRef:
name: function-calling-extension-secret
key: CLIENT_ID
- name: CLIENT_SECRET
valueFrom:
secretKeyRef:
name: function-calling-extension-secret
key: CLIENT_SECRET
- name: FQDN
value: "http://<public-ip-address>"
Apply the Deployment using the following command:
kubectl apply -f deployment.yaml
- Ensure that the
CLIENT_ID
andCLIENT_SECRET
values in the Secret are Base64 encoded. - Replace
<public-ip-address>
in the Deployment YAML with the actual public IP address of the Service once it is available.