kubernetes / website

Kubernetes website and documentation repo:
https://kubernetes.io
Creative Commons Attribution 4.0 International
4.46k stars 14.37k forks source link

Problem following tutorial Run a Replicated Stateful Application #33223

Open tomas-pritrsky opened 2 years ago

tomas-pritrsky commented 2 years ago

This tutorial is wrong, the replicas fail on Error. Applying the mysql-statefulset.yaml I see only mysql-0 running - mysql-1 fails on Init:Error

fails here : https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/#:~:text=kubectl%20apply%20%2Df%20https%3A//k8s.io/examples/application/mysql/mysql%2Dstatefulset.yaml

sftim commented 2 years ago

/retitle Problem following tutorial Run a Replicated Stateful Application

Kartik494 commented 2 years ago

@tomaspritrsky Could you please share error logs you are getting in init containers

LukasBommes commented 2 years ago

I encountered the same issue following the tutorial. Here is my output for kubectl logs pod/mysql-1 clone-mysql

+ [[ -d /var/lib/mysql/mysql ]]
++ hostname
+ [[ mysql-1 =~ -([0-9]+)$ ]]
+ ordinal=1
+ [[ 1 -eq 0 ]]
+ ncat --recv-only mysql-0.mysql 3307
+ xbstream -x -C /var/lib/mysql
+ xtrabackup --prepare --target-dir=/var/lib/mysql
xtrabackup version 2.4.4 based on MySQL server 5.7.13 Linux (x86_64) (revision id: df58cf2)
xtrabackup: cd to /var/lib/mysql
xtrabackup: Error: cannot open ./xtrabackup_checkpoints
xtrabackup: error: xtrabackup_read_metadata()
xtrabackup: This target seems not to have correct metadata...
InnoDB: Number of pools: 1
InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
xtrabackup: Warning: cannot open ./xtrabackup_logfile. will try to find.
InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
  xtrabackup: Fatal error: cannot find ./xtrabackup_logfile.
xtrabackup: Error: xtrabackup_init_temp_log() failed.

kubectl logs pod/mysql-1 init-mysql shows the following.

++ hostname
+ [[ mysql-1 =~ -([0-9]+)$ ]]
+ ordinal=1
+ echo '[mysqld]'
+ echo server-id=101
+ [[ 1 -eq 0 ]]
+ cp /mnt/config-map/replica.cnf /mnt/conf.d/
tomas-pritrsky commented 2 years ago

yes, I have the same error as @LukasBommes

SuperChenSSS commented 2 years ago

Hi Team, I could also confirm that I have the same error while following the tutorial, seems the doc needs some update.

ProtoSeo commented 2 years ago

I had the same problem too, but I modified 'mysql-configmap.yaml` file below and solved it. @LukasBommes @tomaspritrsky

apiVersion: v1
kind: ConfigMap
metadata:
  name: mysql
  labels:
    app: mysql
data:
  primary.cnf: |
    # Apply this config only on the primary.
    [mysqld]
    log-bin
    # datadir=/var/lib/mysql/mysql    
  replica.cnf: |
    # Apply this config only on replicas.
    [mysqld]
    super-read-only
    # datadir=/var/lib/mysql/mysql    
sftim commented 2 years ago

Thanks @tomaspritrsky @ProtoSeo

/triage accepted /kind bug /priority important-longterm

Priority because a bug in this page blocks people learning about using Kubernetes to persist data, and that's a key thing for folks to want to learn.

Kartik494 commented 2 years ago

/assign

Kartik494 commented 2 years ago

/unassign

krapie commented 1 year ago

I'm having a same issue on this part of the tutorial. xtrabackup: Error: xtrabackup_init_temp_log() failed.

I thought the problem was that mysql and gcr.io/google-samples/xtrabackup:1.0 were not compatible anymore, so the commands were not executable.

I tried image version change & command change but I'm getting different errors :(

Any help??

k8s-triage-robot commented 1 year ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

ratnopamc commented 1 year ago

Following this https://v1-24.docs.kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/#simulate-pod-and-node-downtime example and the readiness probe fails but the pod keeps running. Can anyone fix the doc or suggest a work-around?

Update - Changing the command for introducing failure as below worked for me.

Change kubectl exec mysql-2 -c mysql -- mv /usr/bin/mysql /usr/bin/mysql.off to kubectl -n workshop exec mysql-2 -c mysql -- sh -c 'echo "#!/bin/sh" >> /mysql;echo "exit 1" >> /mysql;chmod +x /mysql;cp /usr/bin/mysql /usr/bin/mysql.off;cp /mysql /usr/bin/mysql;'

Thanks.

vaibhav2107 commented 1 year ago

/remove-lifecycle stale

k8s-triage-robot commented 8 months ago

This issue has not been updated in over 1 year, and should be re-triaged.

You can:

For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/

/remove-triage accepted

k8s-triage-robot commented 5 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 4 months ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

errhama commented 1 week ago

This tutorial is wrong, the replicas fail on Error. Applying the mysql-statefulset.yaml I see only mysql-0 running - mysql-1 fails on Init:Error

fails here : https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/#:~:text=kubectl%20apply%20%2Df%20https%3A//k8s.io/examples/application/mysql/mysql%2Dstatefulset.yaml

I have the same issue , please did you resolve the issue ?