reactive-tech / kubegres

Kubegres is a Kubernetes operator allowing to deploy one or many clusters of PostgreSql instances and manage databases replication, failover and backup.
https://www.kubegres.io
Apache License 2.0
1.32k stars 74 forks source link

[ImagePullBackOff] kubegres-controller-manager #152

Open zbloss opened 1 year ago

zbloss commented 1 year ago

Following the Getting Started guide, I'm getting ImagePullBackOff errors for the kubegres-controller-manager when I

kubctl apply -f kubegres.yaml

I've isolated the problem down to the kubegress-controller-manager deployment at

spec.template.spec.containers[0].image==gcr.io/kubebuilder/kube-rbac-proxy:v0.13.0

Swapping this out for the latest (v0.14.0) bitnami image on dockerhub resolves the issue, I'll be fast-following with a PR to make this change.


apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    control-plane: controller-manager
  name: kubegres-controller-manager
  namespace: kubegres-system
spec:
  replicas: 1
  selector:
    matchLabels:
      control-plane: controller-manager
  template:
    metadata:
      annotations:
        kubectl.kubernetes.io/default-container: manager
      labels:
        control-plane: controller-manager
    spec:
      containers:
      - args:
        - --secure-listen-address=0.0.0.0:8443
        - --upstream=http://127.0.0.1:8080/
        - --logtostderr=true
        - --v=0
        image: bitnami/kube-rbac-proxy:0.14.0
        name: kube-rbac-proxy
        ports:
        - containerPort: 8443
          name: https
          protocol: TCP
        resources:
          limits:
            cpu: 500m
            memory: 128Mi
          requests:
            cpu: 5m
            memory: 64Mi
        securityContext:
          allowPrivilegeEscalation: false
          capabilities:
            drop:
            - ALL
      - args:
        - --health-probe-bind-address=:8081
        - --metrics-bind-address=127.0.0.1:8080
        - --leader-elect
        command:
        - /manager
        image: reactivetechio/kubegres:1.16
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8081
          initialDelaySeconds: 15
          periodSeconds: 20
        name: manager
        readinessProbe:
          httpGet:
            path: /readyz
            port: 8081
          initialDelaySeconds: 5
          periodSeconds: 10
        resources:
          limits:
            cpu: 500m
            memory: 128Mi
          requests:
            cpu: 10m
            memory: 64Mi
        securityContext:
          allowPrivilegeEscalation: false
          capabilities:
            drop:
            - ALL
      securityContext:
        runAsNonRoot: true
      serviceAccountName: kubegres-controller-manager
      terminationGracePeriodSeconds: 10
edwardzjl commented 9 months ago

I believe the issue lies with your network, preventing access to gcr.io. To resolve this, consider utilizing kustomization rather than modifying the image on the upstream.

Here's a kustomization file that could solve your problem:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
  - https://raw.githubusercontent.com/reactive-tech/kubegres/v1.17/kubegres.yaml

images:
  - name: gcr.io/kubebuilder/kube-rbac-proxy
    newName: bitnami/kube-rbac-proxy