npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@citymallservices/k8s-grpc-resolver

v1.1.8

Published

A custom gRPC resolver for Kubernetes services that enables service discovery in Kubernetes clusters. This resolver allows gRPC clients to automatically discover and connect to services running in Kubernetes without hardcoding IP addresses.

Readme

k8s-grpc-resolver

A custom gRPC resolver for Kubernetes services that enables service discovery in Kubernetes clusters. This resolver allows gRPC clients to automatically discover and connect to services running in Kubernetes without hardcoding IP addresses.

Overview

When running microservices in Kubernetes, service discovery can be challenging, especially for gRPC services. This library provides a custom resolver that:

Watches Kubernetes Endpoints resources to track service IP addresses Automatically updates gRPC client connections when endpoints change Handles failover and load balancing across multiple service instances Works seamlessly within Kubernetes clusters

The resolver is available in two implementations:

  • Golang implementation using the official gRPC resolver interface
  • Node.js implementation using @grpc/grpc-js

Features

  • Dynamic Service Discovery: Automatically discovers service endpoints in Kubernetes
  • Live Updates: Watches for changes in service endpoints and updates connections in real-time
  • Fallback Mechanism: Node.js implementation falls back to DNS resolution if Kubernetes API is unavailable
  • Error Handling: Implements backoff strategies for reconnection attempts
  • Simple Integration: Easy to integrate with existing gRPC clients

Installation

Golang

go get github.com/city-mall/k8s-grpc-resolver/golang

Node.js

npm install @citymallservices/k8s-grpc-resolver

Usage

Golang

import (
    "google.golang.org/grpc"
    k8sresolver "github.com/city-mall/k8s-grpc-resolver/golang"
)

func main() {
    // Register the resolver
    resolver := k8sresolver.Builder()

    // Use the resolver in your gRPC client
    // Format: k8s://<namespace>/<service-name>:<port>
    conn, err := grpc.Dial(
        "k8s://default/my-service:8080",
        grpc.WithResolvers(resolver),
        grpc.WithInsecure(),
    )
    if err != nil {
        // Handle error
    }
    defer conn.Close()

    // Use the connection with your gRPC client
    client := pb.NewMyServiceClient(conn)
    // ...
}

For services with the standard Kubernetes DNS format (service.namespace.svc.cluster.local), you can use the Try helper function:

import (
    k8sresolver "github.com/city-mall/k8s-grpc-resolver/golang"
)

// Convert standard Kubernetes DNS to resolver format
address := k8sresolver.Try("my-service.default.svc.cluster.local:8080")
// address will be "k8s://default/my-service:8080"

Node.js

import { setup } from "@citymallservices/k8s-grpc-resolver";
import { credentials, createClient } from "@grpc/grpc-js";

// Register the resolver and get the formatted address
const address = setup("my-service.default:8080");

// Create a client with the address
const client = createClient(address, credentials.createInsecure());

// Use the client as normal

How It Works

Golang Implementation

The Golang implementation:

  1. Registers a custom resolver with the k8s:// scheme
  2. Uses the Kubernetes API to watch Endpoints resources for the specified service
  3. Extracts IP addresses from the Endpoints resource
  4. Updates the gRPC client connection with the new addresses

Node.js Implementation

The Node.js implementation:

  1. Registers a custom resolver with the k8s:// scheme
  2. Initially uses DNS resolution while attempting to connect to the Kubernetes API
  3. Once connected, watches Endpoints resources for the specified service
  4. Updates the gRPC client connection with the new addresses
  5. Implements backoff strategies for reconnection attempts

Requirements

Golang

  • Kubernetes cluster with API access
  • Proper RBAC permissions to read Endpoints resources
  • Go 1.15 or later

Node.js

  • Kubernetes cluster with API access
  • Proper RBAC permissions to read Endpoints resources
  • Node.js 14 or later
  • @grpc/grpc-js 1.13.4 or later
  • @kubernetes/client-node 1.3.0 or later

Publishing

To publish a new version of the Node.js package:

  1. Update the version in package.json
  2. Run the following command:
npm publish

License

ISC

Author

Arkadev Banerjee


This project is maintained by CityMall Services.