LATEST VERSION: v1.2 - RELEASE NOTES
Pivotal Container Service v1.2

Creating Sink Resources

Page last updated:

This topic describes how to create a sink resource for a Kubernetes cluster provisioned with Pivotal Container Service (PKS) or for a namespace within a cluster.

Sink resources enable PKS users to configure destinations for logs transported following the Syslog Protocol defined in RFC 5424.

Prerequisites

Before you can create a sink resource for a namespace within a PKS-provisioned Kubernetes cluster, you must ensure that the Enable Sink Resources checkbox is selected in the PKS tile. Selecting this checkbox enables namespaces to send logs to sinks.

For more information, see the Logging section of the PKS installation topic for your IaaS:

Note: The commands in this topic require that you install the Kubernetes Command Line Interface (CLI), kubectl. For installation instructions, see Installing the Kubernetes CLI.

Define Sink Resources

You can create sinks for clusters and namespaces. A namespace sink filters logs by namespace within a cluster.

ClusterSink Resource

Note: If you upgrade to PKS v1.2.1, creating a ClusterSink fails. This issue occurs only after an upgrade to PKS v1.2.1 and does not apply to new installations of PKS v1.2.1 or later. For more information, see the corresponding Knowledge Base article.

To define a ClusterSink resource, create a YAML file that specifies your log destination in the following format:

apiVersion: apps.pivotal.io/v1beta1
kind: ClusterSink
metadata:
  name: YOUR-SINK
spec:
  type: syslog
  host: YOUR-LOG-DESTINATION
  port: YOUR-LOG-DESTINATION-PORT
  enable_tls: true

Where:

  • YOUR-SINK is a name you choose for your sink.
  • YOUR-LOG-DESTINATION is the URL of your log management service.
  • YOUR-LOG-DESTINATION-PORT is the port number of your log management service.

Sink Resource

To define a Sink resource, create a YAML file that specifies your log destination in the following format:

apiVersion: apps.pivotal.io/v1beta1
kind: Sink
metadata:
  name: YOUR-SINK
  namespace: YOUR-NAMESPACE
spec:
  type: syslog
  host: YOUR-LOG-DESTINATION
  port: YOUR-LOG-DESTINATION-PORT
  enable_tls: true

Where:

  • YOUR-SINK is a name you choose for your sink.
  • YOUR-NAMESPACE is the name of your namespace.
  • YOUR-LOG-DESTINATION is the URL of your log management service.
  • YOUR-LOG-DESTINATION-PORT is the port number of your log management service.

Create Sink Resources

To create the ClusterSink or Sink resource that you defined in the previous step, run the following command:

kubectl apply -f MY-SINK.yml

Where MY-SINK.yml is the name of your YAML file.

For example:

$ kubectl apply -f example-sink.yml

Manage Sinks

To list and delete sinks, use the following commands:

Cluster Sinks

  • kubectl get clustersinks. List the sink resources deployed to your cluster.
  • kubectl delete clustersink YOUR-SINK. Delete a sink, where YOUR-SINK is the name of your sink.

Namespace Sinks

  • kubectl get sinks. List the sink resources deployed to a namespace.

  • kubectl delete sink YOUR-SINK. Delete a sink, where YOUR-SINK is the name of your sink.


Please send any feedback you have to pks-feedback@pivotal.io.

Create a pull request or raise an issue on the source for this page in GitHub