WoozyMasta / kube-dump

Backup a Kubernetes cluster as a yaml manifest
https://kube-dump.woozymasta.ru
GNU General Public License v3.0
318 stars 64 forks source link

Kube-dump Not working as expected #18

Open OMO-NOSA opened 3 years ago

OMO-NOSA commented 3 years ago

Hello All,

I ran kube-dump as a kubernetes pod within my container and did the configuration to store both on a persistent disk and on a github repo.

I currently do not know the state of this as it is not showing a reasonable log information. Please see attached image.

Thanks kube-dump

WoozyMasta commented 3 years ago

@OMO-NOSA, can you provide more information?

Please show me the output of the commands kubectl describe pod kube-dump and kubectl get events | grep kube-dump for the namespace where pod is running.

OMO-NOSA commented 3 years ago

@WoozyMasta Here:

kubectl describe pod kube-dump output: ``` ame: kube-dump Namespace: dataworks Priority: 0 Node: aks-nodepool-91939667-vmss000000/10.240.0.159 Start Time: Thu, 15 Apr 2021 01:55:39 +0000 Labels: app=kube-dump Annotations: Status: Running IP: 10.240.0.232 IPs: IP: 10.240.0.232 Containers: kube-dump: Container ID: docker://65150dd921528d1664856f27f735148d081a489f8162e52bf41086223861d61b Image: woozymasta/kube-dump:1.0 Image ID: docker-pullable://woozymasta/kube-dump@sha256:5d8bc2ef0361972f2f92901057d61cb8707681f48ecc104e68dbc97c3635c5c9 Port: Host Port: Command: /bin/bash -c -- Args: while true; do sleep 60; done; State: Running Started: Wed, 21 Apr 2021 20:21:10 +0000 Last State: Terminated Reason: Error Exit Code: 255 Started: Thu, 15 Apr 2021 01:56:47 +0000 Finished: Wed, 21 Apr 2021 20:19:31 +0000 Ready: True Restart Count: 1 Limits: cpu: 500m memory: 200Mi Requests: cpu: 200m memory: 100Mi Environment: MODE: dump DESTINATION_DIR: /data/dump GIT_PUSH: true GIT_BRANCH: master GIT_REMOTE_URL: GIT_COMMIT_EMAIL: GIT_COMMIT_USER: Mounts: /data from data (rw) /root/.ssh/id_ed25519 from key (rw,path="id_ed25519") /root/.ssh/id_ed25519.pub from key-pub (rw,path="id_ed25519.pub") /var/run/secrets/kubernetes.io/serviceaccount from kube-dump-token-szlhv (ro) Conditions: Type Status Initialized True Ready True ContainersReady True PodScheduled True Volumes: data: Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace) ClaimName: kube-dump ReadOnly: false key: Type: Secret (a volume populated by a Secret) SecretName: kube-dump-key Optional: false key-pub: Type: Secret (a volume populated by a Secret) SecretName: kube-dump-key Optional: false kube-dump-token-szlhv: Type: Secret (a volume populated by a Secret) SecretName: kube-dump-token-szlhv Optional: false QoS Class: Burstable Node-Selectors: Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s node.kubernetes.io/unreachable:NoExecute op=Exists for 300s Events: ```

kubectl get events | grep kube-dump ==> this command did not return anything

WoozyMasta commented 3 years ago

@OMO-NOSA, It looks like everything is working well, have you tried running a dump task?

For example: kubectl exec -ti -n kube-dump kube-dump -- /kube-dump ns -n kube-dump

WoozyMasta commented 3 years ago

Perhaps it was not obvious from the document, I corrected it, I hope it will be clearer this way

8b2135f19e074271742ee2332fb1a56ba0dadb23

OMO-NOSA commented 3 years ago

@WoozyMasta Getting this Error: Error from server (Forbidden): pods "kube-dump" is forbidden: User "system:serviceaccount:kube-dump:kube-dump" cannot get resource "pods" in API group "" in the namespace "kube-dump"

and this: Error: Found running on kubernetes cluster but attempting connect to API 10.0.0.1:443 failed with code 401 command terminated with exit code 1

WoozyMasta commented 3 years ago

@OMO-NOSA, you have exactly set the ClusterRoleBinding from the deploy/cluster-role-view.yaml file?

If so then try this:

It looks like you don't have a standard view role in the cluster. Create this role from the clusterrole-view.yml file.

Or you can issue the cluster-admin role, apply this deploy/cluster-role-admin.yaml file (this is not a good solution to issue the administrator role, I do not recommend doing this in a production environment)

OMO-NOSA commented 3 years ago

@WoozyMasta all my configuration seems good and up-to-date.

What will you suggest the issue here is? Will saving the files to a git repo be any different? If so, be guide me on the process, as the documentation isn't thorough enough. Thanks