Giter VIP home page Giter VIP logo

leader-elector's Introduction

Leader-elector sidecar container

This repo contains the election directory forked from kubernetes/contrib. Info on how to use this can be found on Kubernetes blog.

leader-elector's People

Contributors

aledbf avatar apelisse avatar bprashanth avatar brendandburns avatar eparis avatar fgrzadkowski avatar foxish avatar freehan avatar gmarek avatar grodrigues3 avatar ingvagabund avatar ixdy avatar jasonbrooks avatar k8s-ci-robot avatar lavalamp avatar maciekpytel avatar madhusudancs avatar mikedanese avatar mwielgus avatar piosz avatar q-lee avatar random-liu avatar roberthbailey avatar rutsky avatar spxtr avatar stephenrlouie avatar tallclair avatar thockin avatar wojtek-t avatar xialonglee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

leader-elector's Issues

Issues when I create this image

I do not have access to the redhat repo for downloading the images. So I changed the images with other simple ones, the issue is the leader-elector container is not able to pick up the name.

Will not report event: 'Normal' '%v became leader' '$(hostname)'
I0524 08:53:43.227183 1 leaderelection.go:215] sucessfully acquired lease default/example
$(hostname) is the leader
$(hostname) is the leader

Below is the docker file:

FROM golang:1.13 as builder

ADD election /go/src/k8s.io/contrib/election
RUN cd /go/src/k8s.io/contrib/election
&& CGO_ENABLED=0 GOOS=linux GO111MODULE=off go build -a -installsuffix cgo -ldflags '-w' -o leader-elector example/main.go

FROM debian:jessie

ENV DEBIAN_FRONTEND=noninteractive

RUN
apt-get update &&
apt-get install -y ca-certificates &&
rm -rf /var/lib/apt/lists/*

COPY --from=builder /go/src/k8s.io/contrib/election/leader-elector /usr/bin/

USER 1001

ENTRYPOINT [ "leader-elector", "--id=$(hostname)" ]

LABEL
io.k8s.description="This is a component of OpenShift Container Platform and provides a leader-elector sidecar container."
com.redhat.component="leader-elector-container"
maintainer="Michal Dulko [email protected]"
name="openshift/ose-leader-elector"
summary="This image provides leader election functionality and can be used as a sidecar container."
io.k8s.display-name="leader-elector"
version="v4.0.0"
io.openshift.tags="openshift"

Networking error in leader election endpoint

Description

We are implementing a leader election strategy for a High Availability service. We are using the ose-leader-elector-rhel8:v4.7 as the base image for the sidecar container, here you have the hole implementation:

-   name: jupyterhub-ha-sidecar
    image: 'registry.redhat.io/openshift4/ose-leader-elector-rhel8:v4.7'
    args:
      - '--election=jupyterhub-ha-election'
      - '--election-namespace=$(NAMESPACE)'
      - '--http=0.0.0.0:4040'
      - '--id=$(POD_NAME)'
    env:
      - name: NAMESPACE
        valueFrom:
          fieldRef:
            apiVersion: v1
            fieldPath: metadata.namespace
      - name: POD_NAME
        valueFrom:
          fieldRef:
            apiVersion: v1
            fieldPath: metadata.name

The current implementation works great, but given a certain amount of time we bump into the following error in every pod that's running the sidecar container:

E0907 03:43:50.043988       1 leaderelection.go:253] error retrieving endpoint: Get "https://172.30.0.1:443/api/v1/namespaces/redhat-ods-applications/endpoints/jupyterhub-ha-election": http2: no cached connection was available

With this issue, the leader election strategy doesn't work, as the sidecar images don't provide the current name of the leader. Restarting the container fixes the problem.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.