This page will guide you through onboarding an application deployment to a slice, as well as setting up the necessary ServiceExports if necessary.
<slice name> |
Name of the slice the application should be deployed on. |
<cluster name> |
Name of the name the application will be deployed on. |
<namespace> |
The namespace the application will be deployed on. |
<deployment yaml> |
The path to the application deployment .yaml file. |
Updating the Deployment .yaml File
To onboard an application onto a slice, you will need to modify the application deployment .yaml file to include the below annotation:
metadata:
annotations:
avesha.io/slice: <slice name>
As an example, here is the top portion of an iperf application deployment file with the correct annotation:
apiVersion: apps/v1
kind: deployment
metadata:
name: iperf
namespace: iperf
labels:
app: iperf
annotations:
avesha.io/slice: <slice name>
spec:
...
Deploying the Deployment .yaml File
First, switch contexts to the cluster you will be deploying the application(s) to:
kubectx <cluster name>
You are now able to use the below command to apply the deployment .yaml file created in the previous section:
kubectl apply -f <deployment yaml> -n <namespace>
Verify your deployment by getting and listing the pods in the namespace in which the deployment .yaml file was applied:
kubectl get pods -n <namespace>
<serviceexport name> |
What you will name the ServiceExport. |
<slice name> |
Name of the slice the application should be deployed on. |
<serviceexport name> |
Name of the name the application will be deployed on. |
<key>: <value> |
The spec: selector: label pointing to your service. |
<protocol name> |
The protocol being used for external communications (ex: tcp). |
<port> |
The port being used for external communications. |
<protocol> |
The protocol being used for external communications (ex: TCP). |
<serviceexport yaml> |
The path to the application deployment .yaml file. |
Creating a ServiceExport
To export a service, you will want to create a service export .yaml file following the template below:
apiVersion: mesh.avesha.io/v1beta1
kind: ServiceExport
metadata:
name: <serviceexport name>
spec:
slice: <slice name>
selector:
matchLabels:
<key>: <value>
meshType: none
ingressEnabled: false
ports:
- name: <protocol name>
containerPort: <port>
protocol: <protocol>
To apply the service export to the service deployed in the previous section, use the command below targeting the newly created service export .yaml file:
kubectl apply -f <serviceexport yaml> -n <namespace>
You can verify the service was exported successfully using the below command:
kubectl get serviceexport <serviceexport name> -n <namespace>
The service will now be exported and reachable through KubeSlice DNS as:
<application name>.<slice name>.svc.slice.local
ServiceImports
When a ServiceExport is deployed, the corresponding ServiceImport is automatically created on each of the clusters that are part of the slice. This populates the necessary DNS entries and ensures your traffic always reaches the correct cluster and endpoint.
You can verify the service was imported on other clusters correctly using the below command:
kubectl get serviceimport <serviceexport name> -n <namespace>
That’s all there is to it!
Feel Free to Follow our Tutorials on Installing Specific Applications Here:
Reverse the Process and Begin Uninstalling KubeSlice Here: