Skip to content

External IP discovery for Kubernetes init container

License

Notifications You must be signed in to change notification settings

joonix/k8s-externalip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

External IP Init

A configuration helper to provide external IP discovery.

Replaces a placeholder in a configuration file with the external IP reported by kubernetes.

Docker image

Can be released to your private GCP registry with:

REGISTRY=gcr.io/yourproject make release

Example k8s config

Deployment spec

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: app
spec:
  initContainers:
  - name: app-config
    image: foo:bar
    args:
      - -configmap=config
      - -filename=/app/config/appsettings.xml
    volumeMounts:
      - name: conf
        mountPath: /app/config
  containers:
  - name: app
    image: app:latest
    volumeMounts:
      - name: conf
        mountPath: /app/config
  volumes:
    - name: conf
      emptyDir: {}

Config map

apiVersion: v1
kind: ConfigMap
metadata:
  name: config
data:
  appsettings.xml: |
    <?xml version="1.0" encoding="utf-8"?>
    <Settings>
      <MatchPoolName>MatchPool</MatchPoolName>
      <ExternalAddress>K8S_EXTERNALADDRESS</ExternalAddress>
    </Settings>

This will replace appsettings.xml values before it is read by the container.

About

External IP discovery for Kubernetes init container

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published