coreos / etcd-operator

etcd operator creates/configures/manages etcd clusters atop Kubernetes
https://coreos.com/blog/introducing-the-etcd-operator.html
Apache License 2.0
1.75k stars 741 forks source link

failed to constructs tls config: tls: failed to find any PEM data in certificate input #2120

Closed zhangsimingshannonai closed 5 years ago

zhangsimingshannonai commented 5 years ago

What I use: Ubuntu 18.04 etcd-operator 0.9.4

The requests: I want to user etcd-operator's backup crd to backup my external etcd. my kubernetes's etcd is started in docker(not a pod, started by "docker run" and as a external docker against kubernetes).

The ERROR: I already have etcd-operator-backup pod running in my k8s cluster.

$ kubectl get pods -n etcd
NAME                                                              READY   STATUS    RESTARTS   AGE
etcd-operator-nx-etcd-operator-etcd-backup-operator-f65c8d7g2p2   1/1     Running   0          35m
etcd-operator-nx-etcd-operator-etcd-restore-operator-86b577hgmx   1/1     Running   0          35m

Now, I create a backup.yaml to trigger the backup, here is my backup.yml:

apiVersion: "etcd.database.coreos.com/v1beta2"
kind: "EtcdBackup"
metadata:
  name: etcd-cluster-backup
  namespace: etcd
spec:
  etcdEndpoints: ["https://10.20.11.120:2379"]
  clientTLSSecret: etcd
  storageType: S3
  backupPolicy:
    backupIntervalInSecond: 30
    maxBackups: 6
  s3:
    path: xxxxxxxxxxxx/xxxxxxxxxxx/xxxxx
    awsSecret: aws-etcd

Then, I run:

$ kubectl apply -f backup.yml
#and I got 
$ kubectl describe etcdbackups.etcd.database.coreos.com -n etcd
...
Status:
  Reason:             failed to constructs tls config: tls: failed to find any PEM data in certificate input
  Last Success Date:  <nil>
  Succeeded:          false
...

my secret's name is "etcd", and create by:

$ kubectl create secret generic etcd --from-file=ca.crt --from-file=client.crt --from-file=client.key -n etcd

look into the secret and check:

$ apiVersion: v1
data:
  ca.crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURCekNDQWUrZ0F3SUJBZ0lVSDRKZ1c5VzZncUNjRnhhenhtNlhaa2Z3eitJd0RRWUpLb1pJaHZjTkFRRUwKQlFBd0VqRVFNQTRHQ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DFtOUw5RlY1WUE2bjZVQzIvSjQ0QW9DSFU4eXlVQTdaQm1OS0JnTCtIUzhkNkoKWTRtWUpKaUtKQWdkQ3lHbFIvbXFCaVY0MDg5UndVQjRxOXQrWDRlZ0kzbVZrTTgzNGJuSExCSk1GcmJTU0R0bQp1eU1DeWNncTNZb3RrdXc5dVRCUlhWNHR4VFM0ZVZrNkZLSjU4SWNhTndBemhFelFjaTF4VlE9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=
kind: Secret
metadata:
  creationTimestamp: "2019-09-21T03:28:20Z"
  name: etcd
  namespace: etcd
  resourceVersion: "7559268"
  selfLink: /api/v1/namespaces/etcd/secrets/etcd
  uid: dc3dddea-dc1f-11e9-99e3-025e0c22fba8
type: Opaque

check the secret:

$ echo -n "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURCekNDQWUrZ0F3SUJBZ0lVSDRKZ1c5VzZncUNjRnhhenhtNlhaa2Z3eitJd0RRWUpLb1pJaHZjTkFRRUwKQlFBd0VqRVFNQTRHQTFVRUF3d0haWFJqWkMxallUQWdGdzB4T1RBNE1EWXdOVEEzTkROYUdBOHlNVEU1TURjeApNekExTURjME0xb3dFakVRTUE0R0ExVUVBd3dIWlhSalpDMWpZVENDQVNJd0RRWUpLb1pJaHZjTkFRRUJCUUFECmdnRVBBRENDQVFvQ2dnRUJBS0lSMXNRSFNrY3hzNVFBRDQrczFrQnJPS2IvYXdFMU1neENyY2l5QVMybWM2UHEKOU5VSmZWaDdNSVBjb1dsRUpnaDNydVJVbzZEczdxR3VQL01iNnMvbzJtWG1QdGpIM3NwSW9kc2o1V1RDakw4Swo4eGZkTEdHQTA0d1pKZUVuYU1pOGlzWjQvZkptY0F4MitXeHRrQzBjdkxndi83YU8vckFERDZHTkFldjF4U3FtCmF4YUV6Zk1yeDRsMXA0M2dqRDlXSkdYbVdKbWRtdy9teGdVQWVhOUFnM01seWtFVzBINHEydW5LMW90THRmemkKMG8ze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Gt
MecWQuq52+8mwMn5pgdS8HjckpBNK67tulclRsv5w8c+7w5iWVAPX821AoGBAMgo
3frYd42qOPXfEWOKpMi8u2o49QBPjG181ypj3rRcEDbga7kO9xjSFD1gO+BG88wb
NL3SQm9GS+vKNgoGHXWOivaAW19g/XNx/aZhq3tZQW9aGULJx7Vv04Ez3myLc7Yn
znkqvrOLJ7iS1aceBO1Z0aXdT3oKan7tvt3/AHAJAoGAD70N9qk0JwCKQrS8dKZk
sGliddSLFv7b/zNj6G//6/n/DKrnVdR6mAT57FDpXIHTlVa8Qfs354yj+U+uz7Jl
L3/r4o7YbvFjGghwtbyhoQ/lOlo5LLSpAMxx3OLvxUpJAOqkxFa/U6nw2dTq0o+L
Up+5jzd2hZncS4MRpk0Zkg0CgYBXBl2tCJzCPTZSwE/BJbCLjnM1tdnf7rYxjEvI
pG9Zn4V1NpHffgA1DHG8VbDyzCaHoXSG63nzA29S7zIbnZkFWZpVnm0bxQGtRexw
gJqcIKxwi43cGfr4icw9qp2UN/VxR1FgIROU4HW+rCi0ZjriL2EVaml5uDmhQiDw
SESacQKBgQDYRZRbQt1m9L9FV5YA6n6UC2/J44AoCHU8yyUA7ZBmNKBgL+HS8d6J
Y4mYJJiKJAgdCyGlR/mqBiV4089RwUB4q9t+X4egI3mVkM834bnHLBJMFrbSSDtm
uyMCycgq3Yotkuw9uTBRXV4txTS4eVk6FKJ58IcaNwAzhEzQci1xVQ==
-----END RSA PRIVATE KEY-----

The Question: It seem that the problem is cannot find cert in my secret, but everything I check is absolutely right, did I miss something? I'm trying to use tls to connect to my external etcd. Hope for any reply!

zhangsimingshannonai commented 5 years ago

Finally got the reason, See:https://github.com/coreos/etcd-operator/blob/aeb3e3e0835ec5135cfe50340f59853b5b6fc407/pkg/apis/etcd/v1beta2/backup_types.go#L74-L80

In the secret, data name must set to:

    // data:
    //    "etcd-client.crt": <pem-encoded-cert>
    //    "etcd-client.key": <pem-encoded-key>
    //    "etcd-client-ca.crt": <pem-encoded-ca-cert>

And the order must be same as above... I'm going to close the issue.