wasmに興味がある今日この頃
krustletはwasmを動かせるKubeletで、rustで実装されている
krustletのインストールはダウンロードしてPATHが通ったところに置くだけ
krustlet/install.md at master · deislabs/krustlet · GitHub
だいたいこの通りにやった
minikubeでやる方法が紹介されているが、今回はDocker for Macについてるkubernetes (docker-desktop
)でやった
krustlet/krustlet-on-minikube.md at master · deislabs/krustlet · GitHub
まずはbootstrap
curl https://raw.githubusercontent.com/deislabs/krustlet/master/docs/howto/assets/bootstrap.sh -sSf | bash
こうすると、~/.krustlet/config/bootstrap.conf
が作られる
$ cat .krustlet/config/bootstrap.conf apiVersion: v1 clusters: - cluster: certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM1ekNDQWMrZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJd01URXlOakV4TXpReE4xb1hEVE13TVRFeU5ERXhNelF4TjFvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBT1V3Cm9vZUhhQytMSFV1MUhZK3N6L1RsREp4Tmw5UkFzSzRUT2h1dVNwNzVRaS81dUh4Z2tiSmNIVjZ3NmI4NGx0bzAKUGVVVHBWOFhneFlUZlF2SERwOFc5bGVUQy96amh0WXNJSUFzbDkrQ2NBOHRxNmp2VXRYOGhRVXNEbWdjb2VZSgpRUzJqV3VIZDhjaEhTQTdBbEYrWnFPVTN0bmJ4TkRpeHphMEFnTit6R0J3WDFyY3ZVMWRoNWVRS1Fod1B0T3NQCkFEUzRVNmExMEdHTHZqTjNxd3VGdlNGKzBxUHU1SytlY1dJRDhEa1lXU1NxOXE4azVtVkZpUHBXMXI5Z1p1dUoKMnVCbXorenE1bks5c2dJdTFRTzBMbnBvNlVMaWxOT1NOVDVJeDdFMFMzVkwwbDk4ZHN4SlU2dWQwNlFMbWdkMQpOaU4ra1IxQ0dZZ21BZWdaWUVNQ0F3RUFBYU5DTUVBd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0hRWURWUjBPQkJZRUZCUUFIYmh4TnNyS1J5YVlURVJKOEpMRTF3bmtNQTBHQ1NxR1NJYjMKRFFFQkN3VUFBNElCQVFDL01NZUtqUTZ6U0I0Q1pzYlBzd3V3VlhNVnlrYjFIdFF4VXFKbmlnMU9LTytoU3ZHVQpqUkluSExtcEkyMkpSUnNHWkZPbWc5Q1NwWW52bjludmVIV0lma3A1YjFUa2FTdWc5NVVDTmFSTG8xZmRkTW54CmlzV3VsV2tqck9TOE1QRUtaL2R6RlBiQVArek4yTmpUYVdEcXZCR0dEZXkrTFVWanN4ZXJiS1dDenlHcTI1Q2cKUFVCdTltNkQ2VVUwVzdQVmJUOWZyY1FCWEFUQVREWFFVZW1sNjBVTVhJKzhiM0dEYkx2ZjYvRU9kd0VqaTB4ZApjVU52cUR3YnpwNmxENjA2RlpxY2pTQnRZTEZNcGdvU3B1ZGsxVkhmMTBrRFpEU0FwVFVlMVRNa3MrSzQ3Yzc0CmFDaG9qK2xCVUlRZGZvV2lsQjZBcElLeWJCZ081Tk1NMzFUbAotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg== server: https://kubernetes.docker.internal:6443 name: docker-desktop contexts: - context: cluster: docker-desktop namespace: kube-system user: tls-bootstrap-token-user name: tls-bootstrap-token-user@kubernetes current-context: tls-bootstrap-token-user@kubernetes kind: Config preferences: {} users: - name: tls-bootstrap-token-user user: token: 3mpm3s.2sej4qbstujs1401
このとき、secretsも追加される
$ kubectl get secrets --namespace=kube-system bootstrap-token-3mpm3s bootstrap.kubernetes.io/token 6 93s
krustlet-wasi
を起動する
export KUBECONFIG=~/.krustlet/config/kubeconfig
はやらなかった
$ krustlet-wasi --bootstrap-file=~/.krustlet/config/bootstrap.conf BOOTSTRAP: TLS certificate requires manual approval. Run kubectl certificate approve Cosmos.local-tls
Cosmos.local
は動かしているマシンの名前
certificateをapproveしないといけないので、新しいタブを開いて
$ kubectl certificate approve Cosmos.local-tls certificatesigningrequest.certificates.k8s.io/Cosmos.local-tls approved
すると、CertificateSigningRequestはApprovedになる
$ kubectl get CertificateSigningRequest NAME AGE SIGNERNAME REQUESTOR CONDITION Cosmos.local-tls 2m54s kubernetes.io/kubelet-serving docker-for-desktop Approved,Issued
nodeも追加される
$ kubectl get nodes NAME STATUS ROLES AGE VERSION cosmos.local Ready <none> 18m 0.5.0 docker-desktop Ready master 117m v1.19.3
試しにdemoのHello worldをしてみる
krustlet/demos/wasi/greet at master · deislabs/krustlet · GitHub
$ kubectl apply -f https://raw.githubusercontent.com/deislabs/krustlet/master/demos/wasi/greet/greet-wasi.yaml pod/greet created $ kubectl logs greet Hello, world!
でけた
wasccも後でやってみる