https://github.com/loshz/elasticipd
AWS Elastic IP association daemon
https://github.com/loshz/elasticipd
aws ec2 elasticip k8s kubernetes
Last synced: 3 months ago
JSON representation
AWS Elastic IP association daemon
- Host: GitHub
- URL: https://github.com/loshz/elasticipd
- Owner: loshz
- License: mit
- Created: 2018-05-12T10:37:14.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2024-03-26T14:52:25.000Z (over 1 year ago)
- Last Synced: 2025-02-16T03:11:40.923Z (5 months ago)
- Topics: aws, ec2, elasticip, k8s, kubernetes
- Language: Go
- Homepage:
- Size: 763 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# elasticipd
[](https://github.com/loshz/elasticipd/actions) [](LICENSE) [](https://github.com/users/loshz/packages/container/package/elasticipd)As it is now common practice to run applications on top of a container-orchestration platforms, such as Kubernetes, there is no guarantee that a service will always run on the same host. This can cause problems when a service requiring a public IP address gets rescheduled.
`elasticipd` automatically associates an [Elastic IP](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html) address to the AWS EC2 instance running this service. It is designed to run as a sidecar container alongisde a service that requires a public IP address.## Usage
As `elasticipd` is currently configured to use AWS [Instance Roles](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html), the host will need to have and EC2 Policy with at least the following actions: `DescribeInstances`, `DescribeInstanceAttribute`, `AssociateAddress` and `DisassociateAddress`.The service is configured by setting the following command line flags:
```
Usage of elasticipd:
-elastic-ip string
Elastic IP address to associate
-interval string
Attempt association every interval (default "30s")
-port int
Local HTTP server port (default 8081)
-reassoc
Allow Elastic IP to be reassociated without failure (default true)
-region string
AWS region hosting the Elastic IP and EC2 instance
-retries int
Maximum number of association retries before fatally exiting (default 3)
```### Kubernetes
A simple multi-container Pod spec:
```yaml
apiVersion: v1
kind: Pod
metadata:
name: public-service
spec:
containers:
- name: public-service
image: public-service
- name: elasticipd
image: ghcr.io/loshz/elasticipd:v2.3.0
command: ["elasticipd"]
args: [
"-elastic-ip=",
"-region=us-west-2",
"-interval=10s"
]
ports:
- containerPort: 8081
name: local-http
livenessProbe:
httpGet:
path: /healthz
port: local-http
initialDelaySeconds: 3
periodSeconds: 3
```