|[[スクリプト(Win)]] | [[シェルプログラミング]]
==WSL==
*https://docs.microsoft.com/ja-jp/windows/wsl/install-win10
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
</pre>
===CMD.EXEと組み合わせて利用する===
<pre>
C:\Users\piroto>dir | wsl -- grep 'm'
Volume in drive C has no label.
Volume Serial Number is 06DD-9634
2022/02/03 23:45 <DIR> .templateengine
2022/02/03 22:19 <DIR> Documents
2021/10/22 00:38 <DIR> Saved Games
</pre>
<pre>
C:\Users\piroto\Documents>wsl -- ls -al
total 0
drwxrwxrwx 1 piroto piroto 4096 Feb 3 22:19 .
drwxrwxrwx 1 piroto piroto 4096 Feb 3 22:55 ..
-rwxrwxrwx 1 piroto piroto 0 Oct 28 19:42 Default.rdp
drwxrwxrwx 1 piroto piroto 4096 Feb 3 17:54 IISExpress
lrwxrwxrwx 1 piroto piroto 25 Oct 22 00:37 'My Music' -> /mnt/c/Users/piroto/Music
lrwxrwxrwx 1 piroto piroto 28 Oct 22 00:37 'My Pictures' -> /mnt/c/Users/piroto/Pictures
lrwxrwxrwx 1 piroto piroto 26 Oct 22 00:37 'My Videos' -> /mnt/c/Users/piroto/Videos
drwxrwxrwx 1 piroto piroto 4096 Feb 3 17:54 'My Web Sites'
drwxrwxrwx 1 piroto piroto 4096 Feb 3 23:12 'Visual Studio 2022'
-rwxrwxrwx 1 piroto piroto 402 Oct 22 00:38 desktop.ini
</pre>
===WSL2に更新===
*x64 システムの場合:バージョン 1903 以降、ビルド 18362 以上
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
</pre>
*仮想マシン機能を無効に
<pre>
dism.exe /online /disable-feature /featurename:VirtualMachinePlatform /all /norestart
</pre>
====カーネル更新パッケージのダウンロードと実行====
*SL 2 を実行するには、カーネル コンポーネントの更新が必要です。詳細については https://aka.ms/wsl2kernel を参照してください
<pre>
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \ stable"
</pre>
*Dockerエンジンのインストール
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
</pre>
*[[Kubernetes|minikube のインストール|Kubernetes]]
<pre>
$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
$ sudo chmod +x minkubeminikube
$ sudo install minikube /usr/local/bin
</pre>
===Kubectlのインストール===
<pre>
$ curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
$ sudo chmod +x ./kubectl
$ sudo install kubectl /usr/local/bin
</pre>
===起動===
*ユーザーを[[Docker|docker]]グループに追加
<pre>
$ sudo usermod -aG docker $USER && newgrp docker
</pre>
*[[Docker]]の起動
<pre>
$ sudo service docker start
</pre>
*[[Kubernetes|minikube]]の起動<pre>$ minikubestart --vm-driver=docker</pre>[[File:Wsl_kubernetes.png|Kubernetes600px]]の起動*Unhealthy がある <pre>piroto@buddha:/mnt/c/workspaces/kubernetes$ kubectl get componentstatusesWarning: v1 ComponentStatus is deprecated in v1.19+NAME STATUS MESSAGE ERRORscheduler Unhealthy Get "http://127.0.0.1:10251/healthz": dial tcp 127.0.0.1:10251: connect: connection refusedcontroller-manager Unhealthy Get "http://127.0.0.1:10252/healthz": dial tcp 127.0.0.1:10252: connect: connection refusedetcd-0 Healthy {"health":"true"}</pre>