x509: certificate has expired or is not yet valid

12/15/2019
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml --insecure-skip-tls-verify=true

it comes out to get the log below,

Unable to connect to the server: x509: certificate has expired or is not yet valid

kubernetes 1.14.0

-- cao ting
certificate
install
kubernetes

2 Answers

12/15/2019

when i use command below:

wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

i got the message below:

--2019-12-15 19:08:41--  https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 127.0.0.1
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|127.0.0.1|:443... connected.
ERROR: cannot verify raw.githubusercontent.com's certificate, issued by "XXXXX"

It just because i can't use https in terminal, it not related to the k8s certificate

-- cao ting
Source: StackOverflow

12/16/2019

Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 127.0.0.1 You are trying to connect to localhost

Please check what you have in your /etc/resolve.conf . The issue looks like the issue with your local certifiacte. Ihave just attempted to reproduce it and confirm it's working as expected. I'm able downloading that file.

wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
--2019-12-16 11:56:54--  https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14416 (14K) [text/plain]
Saving to: ‘kube-flannel.yml
kube-flannel.yml                                        100%[==============================================================================================================================>]  14.08K  --.-KB/s    in 0.02s   

2019-12-16 11:56:54 (664 KB/s) -kube-flannel.ymlsaved [14416/14416]

Hope that helps

-- Nick
Source: StackOverflow