2
头图

What are you going to do today?

Today I'm going to give KubeKey a thorn!

As a KubeSphere Community Member , I have never used KubeKey so far, is it too much? It makes me feel ashamed to have a foothold in the KubeSphere community!

Back when I started playing KubeSphere , I felt "discordant" every step of the way. Although KubeSphere already has enough popularity and a large number of enterprise users, I can always pick out "thorns" and give suggestions to the KubeSphere community every day...

That's right, in the end they "couldn't take it" and decided to invite me to the KubeSphere community and become an honorable Member!

Now I also engage in the open source community. Since starting to manage the DevStream open source community, I have basically no energy to participate in the KubeSphere community. Oh, a restless heart, a pair of restless hands! I have to do something, but I don't have the energy to participate in the development, otherwise, let's play my "stinky bug" - late obsessive-compulsive disorder and extreme detail insight, go pick it up!

That's right!

I decided to give KubeKey a try! On the one hand, these "thorns" are fed back to the KubeSphere community to help them further improve the KubeKey experience! On the other hand, familiarize yourself with the usage of KubeKey in this process, and see if you can find the point of cooperation between DevStream and KubeSphere, such as using DevStream to simplify the installation, deployment and configuration process of KubeSphere.

Where do you do it?

The KubeSphere community gave me a development machine, a Linux vm, cool! I'll just "dry" it on this Linux vm!

Where to start?

It's not easy, README document !

Quick dry!

We look for Quick Start in the documentation, yes, there is, roughly like this:

{{< KubeKey Quick Start

fire!

KubeKey Installation 1

Seeing this log, does it look like "no errors, no warnings", it is peaceful and peaceful, and you can use the kubectl command to see the brand new Kubernetes cluster! (Don't talk to me about whether the single-node k8s environment is a cluster, officially called a "single-node cluster")

I will not demonstrate kubectl get xxx , the result is terrible! Let's take a closer look at this output log, yes, fine, have you found that there are several lines of non-error level logs used here to tell us that we need to install first:

  • conntrack
  • socat

Suggestion 1 to KubeKey: Is it more reasonable to use error level logs here?

Suggestion 2 to KubeKey: Can you tell the user directly in the log that conntrack and socat need to be installed first, and print out the installation command at the same time? (I know that the installation methods of centos and ubuntu are different, but the optional command set is actually very limited, it is also easy to obtain the system type by kk, and it is actually easy to do more user-friendly prompts)

Suggestion 3 to KubeKey: There are so many items without y in the table, which ones are required and which ones are not required? This result makes users panic: I need to install so many things before I can start using kk? Stay away!

Solve the dependency problem and move on!

Back to the document, in fact, if you look closely, you can find the pre-dependencies here , but this text is too long, which makes people a little impatient to read it carefully.

conntrack installation

Or Google Dafa is easy to use! We follow this idea to execute the following command:

 yum -y install conntrack-tools
yum -y install socat

If nothing else, this step is difficult to fail. Yes, if you fail, it's an accident. Really failed, that is yum the configuration problem, understand how to deal with it?

Then continue to execute ./kk create cluster and see if you can get a harmonious output. (Remember that if the environment is not "scientific" enough, you must execute export KKZONE=cn first, otherwise you will be stuck for a long time at a certain step, and you will be stuck and doubt your life, and you cannot judge whether the network is too slow or the network is blocked)

Suggestion 4 to KubeKey: When the command is stuck, such as when the image download is too slow, is there a timeout logic? Or can you regularly output a log to tell the user that "it is not stuck"? Or show the progress bar of the download? In short, don't have no logs for a long time, users can't help but go to Ctrl+c, and then look confused, what to do next?

KubeKey Installation 2

It is more harmonious than before, but the first line of the log is very discordant.

If Failed has a big impact, such as making a function unavailable, then you should use the error level, so I will try to fix it; otherwise WARN level means It's "you can ignore it, and you can ignore it." OK, I choose to ignore. (I don't necessarily really ignore it, but many users certainly think so.)

Suggestion 5 to KubeKey: Avoid WARN logs as much as possible, especially when WARN is used together with Failed, which makes users feel that this error is very serious and can be ignored.

Then look at the network environment.

If all goes well, you can finally see this log:

 Installation is complete.

Please check the result using the command:

    kubectl get pod -A

Let's execute kubectl get pod -A and see if the "pea pods" are normal:

 $ kubectl get pod -A
NAMESPACE     NAME                                       READY   STATUS    RESTARTS   AGE
kube-system   calico-kube-controllers-75ddb95444-6dg9b   1/1     Running   0          30m
kube-system   calico-node-rqqrk                          1/1     Running   0          30m
kube-system   coredns-5495dd7c88-9hlrp                   1/1     Running   0          30m
kube-system   coredns-5495dd7c88-nlp5d                   1/1     Running   0          30m
kube-system   kube-apiserver-i-hmqwjh0m                  1/1     Running   0          30m
kube-system   kube-controller-manager-i-hmqwjh0m         1/1     Running   0          30m
kube-system   kube-proxy-x69p9                           1/1     Running   0          30m
kube-system   kube-scheduler-i-hmqwjh0m                  1/1     Running   0          30m
kube-system   nodelocaldns-vd77n                         1/1     Running   0          30m

I'll be darling, Amazing! All Running, 1/1 and 0 restarts, perfect!

How to do it all over again?

Installed, then what?

Let's do it all over again, because direct execution ./kk create cluster without KubeSphere. We have experienced the installation process of k8s, and the overall is quite simple and easy to use. Let's try the game with KubeSphere.

Dry turning operation:

 ./kk delete cluster

After executing this command, the k8s cluster will be deleted. Of course, I don't want the corresponding kubectl and docker images to be deleted, and it turns out that KubeKey doesn't delete them either. Yes, I verified:

kubekey images

Do it together with KubeSphere!

The command is so simple, just adding a flag is enough:

 ./kk create config --with-kubesphere

Can't do it, lose.

The result is not beautiful:

{{< KubeSphere Installation 1

I. . .

you. . .

You gave me one WARN and then hung up directly?

Suggestion 6 to KubeKey: WARN log mentioned earlier, here again confirms my point of view, the log level should be strict, and WARN should be used sparingly.

This error, ,, looks like it's going to Google for a while. But I am lazy! Isn't this related to the docker installation method (I guess it may also be related to the version), I uninstalled docker and let KubeKey install the head office!

Suggestion 7 to KubeKey: If you know the solution to this error, please post the method (or reference link) in the log, don't expect users to easily Google it. Of course, I can't accept you saying I can't solve it, haha, but it's 10:30 in the evening, I want to finish work soon, don't check.

In fact, this machine did not have docker, why did I install it in advance? Because I work hard? nonexistent. I was misled by this passage:

KubeKey Installation Docs

Looking at this indentation level, you glance at it. Is the most conspicuous note below? The Note says to install docker first, and then if you are familiar with docker, do you just install docker first and continue to read the documentation?

Yes, I'm kneeling here. After installing docker, I found out that this Note is a Note for Build Binary from Source Code . . .

Suggestion 8 to KubeKey: The documentation here should also be optimized so that Note doesn't look like a global Note.

Get back together and keep going!

Here is a set of combo punches:

 yum remove docker
./kk create cluster --with-kubesphere

As I expected, the error bypassed!

Yes, I'm so at ease, I can't resist to find out what's going on with the previous mistake, I can still sleep soundly at night after I choose to bypass it! I'm sure the KubeSphere community will tell me the answer in a few days.

KubeSphere Installation 2

You can't see the effect in the screenshot. Let's make up your mind that the arrow above will move left and right, yes, it's dynamic! So cute! I'm going to ask who wrote this code tomorrow, what a lovely programmer!

While waiting for the arrow to stop, add another suggestion to KubeKey:

KubeKey Installation Docs

Suggestion 9 to KubeKey: The documentation here should also be optimized, the style is consistent and more elegant, either write a "example" version, or use [version] placeholder.

KubeSphere Installation 3

Suggestion 10 to KubeKey: y and yes are absolutely the same in user intent, should they be compatible? Include case (I didn't test case compatibility)

KubeSphere Installation 4

Advice 11 to KubeKey: If one install gets stuck for a long time, it may be a network problem. At this time, if Ctrl+c and then re-execute the installation, this will happen, yes, two ks-installers. Of course, I know that I need to delete first to get around it, but maybe kk can recognize that the user has not deleted and give a prompt, which would be more "elegant".

Get back together again and keep going!

Due to the cloud host I used, the previous installation process took too long, I went to take a shower, and the terminal was disconnected when I came back. That's right, when I went in again, I forgot to execute export KKZONE=cn , so it failed once. When executing again, I forgot to delete, so I failed again.

So, I want to delete:

KubeSphere Installation 5

Terrible, horrific! ! !

The docker you installed for me, how can I still have this error?

Likewise, if you tell me WARN, I won't care.

ignore

and

continue!

KubeSphere Installation 6

The funny thing is, looking at the error message this time, it seems that,,, is no different from the previous one. . . But instead of exiting the program directly, it continued to go down! Well, I'm not going to research this bug!

It's time for this "cute to burst" arrow again, let's continue the long wait~

KubeSphere Installation 7

Something is wrong, why is it taking so long, is it hanging up?

Well, wake up my k8s troubleshooting skills that have been dormant for many years (to be precise, more than half a year)!

I see the wrong events information for the ks-installer pod:

KubeSphere Installation 8

Interesting, this is a big bug, right? The mirror doesn't exist? I'll have to ask the insiders:

KubeSphere Installation 9

Suggestion 11 to KubeKey: I can't get through the installation process with the documentation. This is a big bug, so I don't need to elaborate on how to fix it.

One blow, then another decline, three times exhaustion, one last struggle before exhaustion

I don't have the strength to hit "combination punches", a simple command, and then Xiaoquanquan hits Enter:

 ./kk create cluster --with-kubesphere v3.2.1

KubeSphere Installation 10

Guys, it worked for me until 11pm. . . I don't want to be ashamed, I work from home and have to work overtime. I am a man who takes a three-hour lunch break from ten to four...

But to be honest, seeing this familiar log is still very kind! After all, I don't know how many times I read this log last year! (Don’t believe me, I have played it in depth, and there is a video to prove it)

Continue to look at the pod

KubeSphere Installation 11

Very harmonious! Amazing!

(In fact, there is no special harmony, restarts are not all 0. But it doesn't matter, I know this does not affect the function, but there is still room for optimization in the installation process.)

Do you want to see the final Dashboard? I want, too!

But I don't have an ELB, and I'm waiting anxiously... (I entrusted the big guy to configure the ELB for me)

After half an hour...

The login page is here!

KubeSphere Login

After entering, the familiar feeling, the familiar taste!

KubeSphere Dashboard

Later, I must write a few more articles to introduce how to play KubeSphere! That pile of notes back then, those youths who paid for KubeSphere, it would be a pity not to write anything!

final summary

  1. Official documentation is more suitable for "ordinary users" than GitHub's README;
  2. Very sleepy! ! ! I'm going to sleep, what to sum up, nothing to sum up.

last of the last

Please indicate the source!

For more of my articles, please visit my personal website: https://www.danielhu.cn

For more articles from the DevStream team, please visit the DevStream blog site: https://blog.devstream.io

If you want to receive my latest articles in time, please pay attention to my personal public account: Hu Shu Yun Yuan


胡说云原生
23 声望5 粉丝

我是一名开源、云原生、DevOps 技术爱好者;更多关于我的信息,请访问我的个人网站:[链接]