Creating a site on Kubernetes using YAML
Using YAML allows you to create and manage sites from the context of the current namespace.
A typical workflow is to create a site, link sites together, and expose services to the application network.
Creating a simple site on Kubernetes using YAML
You can use YAML to create and manage Skupper sites.
Prerequisites
- The Skupper controller is running on the Kubernetes cluster you are running or you are running on a platform.
Procedure
Create a site CR YAML file named
my-site.yaml, for example:apiVersion: skupper.io/v2alpha1 kind: Site metadata: name: my-site namespace: westThis YAML creates a site named
my-sitein thewestnamespace. Specifying the namespace is not required if the context is set to the namespace where you want to create the site.If you need to link to this site, enable link access:
apiVersion: skupper.io/v2alpha1 kind: Site metadata: name: my-site namespace: west spec: linkAccess: defaultCreate the site:
kubectl apply -f my-site.yamlCheck the status of the site:
kubectl get siteYou might need to issue the command multiple times before the site is ready:
$ kubectl get site NAME STATUS SITES IN NETWORK MESSAGE west Pending containers with unready status: [router kube-adaptor] $ kubectl get site NAME STATUS SITES IN NETWORK MESSAGE west Ready 1 OKYou can now link this site to another site to create an application network.
By default, the router CPU allocation is BestEffort as described in Pod Quality of Service Classes and this might affect performance under network load. Consider setting resources as described in Setting site resources.
There are many options to consider when creating sites using YAML, see the YAML Reference, including frequently used options.
Setting site resources
You can configure the Skupper Router and Kube Adaptor components with minimum and maximum CPU and memory resources by defining sizing models using ConfigMaps.
Note: Increasing the number of routers does not improve network performance. An incoming router-to-router link is associated with just one active router. Additional routers do not receive traffic while that router is responding.
Prerequisites
The Skupper V2 controller is running in your cluster.
You have determined the router CPU allocation you require.
Consider the following CPU allocation options:
Router CPU Description 1 Helps avoid issues with BestEffort on low resource clusters 2 Suitable for production environments 5 Maximum performance
Procedure
Create a sizing ConfigMap in the same namespace where your Skupper V2 controller is running.
The following example defines a sizing configuration named
mediumwith 2 CPU cores suitable for production:apiVersion: v1 kind: ConfigMap metadata: name: sizing-medium labels: skupper.io/site-sizing: "medium" annotations: skupper.io/default-site-sizing: "true" data: router-cpu-limit: "2" router-memory-limit: 1024MiThe Skupper controller selects ConfigMaps based on the presence of a
skupper.io/site-sizinglabel. The label's value serves as an internal identifier for that particular sizing configuration.To designate a sizing model as the default for all sites managed by your Skupper V2 controller instance, annotate the ConfigMap with
skupper.io/default-site-sizing: "true".A sizing ConfigMap can define the following fields:
router-cpu-requestrouter-cpu-limitrouter-memory-requestrouter-memory-limitadaptor-cpu-requestadaptor-cpu-limitadaptor-memory-requestadaptor-memory-limit
Note: If only the
limitfield is defined, Kubernetes will also set therequestwith the same value. If this is not what you want, make sure to set the respectiverequestfield with a smaller value.Determine the controller namespace. Depending on your installation method, the controller namespace may be
skupper,openshift-operators, or have a different name. You can check that you have chosen the correct namespace by running:kubectl get podsConfirm that the skupper controller pod is running in the namespace.
Apply the ConfigMap in the controller namespace:
kubectl apply -f sizing-medium.yamlAssign the sizing configuration to a site by setting the
spec.settings.sizefield in the site resource:apiVersion: skupper.io/v2alpha1 kind: Site metadata: name: my-site spec: settings: size: mediumVerify the resource limits have been applied by inspecting the
skupper-routerdeployment:kubectl get deployment skupper-router -o json | jq .spec.template.spec.containers[].resourcesThe output should look like:
{ "limits": { "cpu": "1", "memory": "1Gi" }, "requests": { "cpu": "500m", "memory": "512Mi" } }
You can define multiple sizing configurations using separate ConfigMaps.
Only one ConfigMap should be annotated as the default (skupper.io/default-site-sizing: "true").