Page cover

Configuration file svc.yaml

The svc.yaml file is a file used for services that are responsible for managing applications running in Pods to the network, both internally in the cluster and externally. Services help in load balancing and allow Pods to communicate with each other or with applications from outside the cluster. In the terminal/command prompt that you use, run the syntax according to the operating system that your computer is using.

  1. Windows

If you are using a Windows operating system, you can use Notepad++ or the text editor your computer uses.

  1. Linux

If you are using the Linux operating system, use the following command.

vim svc.yaml

Add source code for svc.yaml file

apiVersion: v1
kind: Service
metadata:
  name: database-prod-dummy-svc
  namespace: default
spec:
  type: LoadBalancer
  selector:
    vm.kubevirt.io/name: database-prod-vm
  ports:
  - port: 80
    name: http
    targetPort: 80
    protocol: TCP
  - port: 443
    name: https
    targetPort: 443
    protocol: TCP
  - port: 5617
    name: ssh
    targetPort: 22
    protocol: TCP

The following is an explanation of the source code that will be used, so that it can be adjusted to your needs.

Metadata

In the source code section in the metadata section there is a name and namespace. In the name and namespace are the identities used for the service data label that will be used. Give the name label with the name of the service data, while in the namespace section adjust it to the namespace in the vcluster used in the Deka GPU Service Portal.

Specs

In the source code section in the specs section of the svc.yaml file, it is used to define the service specifications to be used. So there are some source codes that must be adjusted.

What needs to be adjusted is in the vm.kubevirt.io/name section: in the selector section, enter the name in the metadata used in the vm.yaml file.

Specs

Use this command syntax to save the changes made to the svc.yaml file.

kubectl apply -f svc.yaml

Last updated