Basic question: How do I send requests via Linkerd


#1

Hi,

I’m having a little bit of trouble wrapping my head around how to send requests to a service via linkerd. I have linkerd running, and I have the hello world example running. I’d like to see my own service route via linkerd. I have the following deployment and service defined:

apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: address
  labels:
    app: address
spec:
  replicas: 3
  selector:
    matchLabels:
      app: address
  template:
    metadata:
      labels:
        app: address
    spec:
      dnsPolicy: ClusterFirst
      containers:
      - name: address
        image: [IMAGE_OMITTED]
        ports:
        - containerPort: 12355
        env:
          - name: NODE_NAME
            valueFrom:
              fieldRef:
                fieldPath: spec.nodeName
          - name: http_proxy
            value: $(NODE_NAME):4140
        args:
          - "-addr=:12355"
---
kind: Service
apiVersion: v1
metadata:
  labels:
    app: address
  name: address
  namespace: default
spec:
  ports:
  - port: 80
    protocol: TCP
    targetPort: 12355
  selector:
    app: address
  clusterIP: None

I guess I have a few questions:

  • Is there anything obviously wrong with my service definitions? When I change the service type to be a LoadBalancer, I’m able to reach the backend pods.
  • Do I need to have namerd running in order to automatically resolve kubernetes services?
  • Is there a full tutorial for dTab around somewhere? I’ve read https://linkerd.io/advanced/dtabs/, but I’m still unclear what the default dTab entries mean. Is /svc a wildcard for a kubernetes service when deployed on a k8s cluster?

Thanks in advance for any help or suggestions!

Best,

Claude


#2

Hi @claudenm. To answer your questions:

Recommend trying a complete example, and then once it’s working, adapt it to your own application, start here:

Note if you have RBAC enabled on your cluster, have a look at the RBAC section in that document.


#3

Hi @siggy,

It was the lack of the named port! Will all my services proxying through l5d require a named port? Can you help me understand why that is?

Thanks again,

Claude


#4

Glad to hear it’s working!

You are correct that your services will need named ports. Linkerd’s Kubernetes namer queries the Kubernetes API to determine where to route traffic. It needs 3 things to do that:

  1. namespace
  2. service name
  3. port name

The Kubernetes namer is explained in a bit more detail here:
https://linkerd.io/config/1.3.5/linkerd/index.html#k8s-path-parameters