pod-ip
TypeScript icon, indicating that this package has built-in type declarations

0.1.8 • Public • Published

Overview

Build Status npm npm bundle size npm codecov

This package consists of a couple of utilities to get IP addresses of containers and host from inside a kubernetes pod or docker container.

Usage

  1. Install this package

using yarn:

yarn add pod-ip

or using npm:

npm install pod-ip
  1. Get IP address (ES6 module syntax)
import * as podIp from "pod-ip";
podIp.ipSync(); // ⇨ '1.1.1.1'

or using CommonJS syntax:

const podIp = require("pod-ip");
podIp.ipSync(); // ⇨ '1.1.1.1'

API Summary

Method
podIp.ip Get IP address asynchronously.
podIp.ipSync Get IP address synchronously.

API

podIp.ip

Get IP address asynchronously

Example:

import * as podIp from "pod-ip";
podIp.ip().then(console.log); // ⇨ '1.1.1.1'

podIp.ipSync

Get IP address synchronously

Example:

import * as podIp from "pod-ip";
podIp.ipSync(); // ⇨ '1.1.1.1'

Acknowledgements

This project was inspired by docker-ip-get and internal-ip.

Package Sidebar

Install

npm i pod-ip

Weekly Downloads

0

Version

0.1.8

License

MIT

Unpacked Size

17.9 kB

Total Files

17

Last publish

Collaborators

  • rabc