It's good to hear you were able to resolve the issue using the recovery mechanism wsl vi /usr/sbin/enter-systemd-namespace
.
But a few points about the process that you are following (with the most important one being last):
I created this following the instructions of official kubernetes site
Note that the page you linked to appears to me to be a guest blog, not "official" documentation. Also note the warning at the top of the page -- I personally really appreciate Kubernetes putting an automatic notice on blog entries that are over a year old:
This article is more than one year old. Older articles may contain outdated content. Check that the information in the page has not become incorrect since its publication.
Considering it uses Ubuntu 18.04, which is only about 6 months away from its End-of-Standard-Support, it could definitely use a refresh.
From the blog post title:
WSL+Docker: Kubernetes on the Windows Desktop
Perhaps I'm misunderstanding a bit, since I'm not a K8s expert, but I think the post should have been more accurately titled, "Minikube on the Windows Desktop".
If you just need Kubernetes, without Minikube, then Docker Desktop includes a K8s server and client with a single-node cluster. See the Docker doc for more information.
Note that the Docker Desktop Kubernetes implementation does not require Systemd.
Also from the blog post:
In order to enable SystemD on WSL2, we will apply the scripts from Daniel Llewellyn.
If you do need Minikube specifically, I'll say that I not a fan of scripts that enable Systemd on WSL. I give my reasons in this answer, but suffice it to say that running inside a Systemd namespace like this drastically changes the way things work in WSL. At the very least, there are/were better (more up-to-date, more robust) options out there than that script.
And now, if you are a Windows 11 user at least, you can use an official Microsoft release of WSL that enables Systemd support. This would almost certainly be a better approach than the script that blog post recommends. See this answer for details on how to enable Systemd support in WSL on Windows 11 using the latest release.