1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

UbuntuにMicroK8sを導入する

Last updated at Posted at 2019-10-11

##はじめに
###前提環境

  • Windows10マシンのVirtualBox上に構築
  • Ubuntu 16.04.6 LTS
  • snap 2.42
  • MicroK8s v1.16.0

###参考にした情報

##セットアップ作業

MicroK8sのインストール

数分で完了した。

hanako@myubuntu:~$ sudo snap install microk8s --classic
microk8s v1.16.0 from 'canonical' installed
hanako@myubuntu:~$

###グループへのユーザー追加と権限確認

  • status確認をしようとすると、一般ユーザーをグループに入れるようにとのメッセージが表示され、追加した。
hanako@myubuntu:~$ microk8s.status --wait-ready
Insufficient permissions to access MicroK8s.
You can either try again with sudo or add the user hanako to the 'microk8s' group:

    sudo usermod -a -G microk8s hanako

The new group will be available on the user's next login.
hanako@myubuntu:~$ sudo usermod -a -G microk8s hanako
hanako@myubuntu:~$
  • ログインしなおし、ステータスの確認をする。(コマンドは正常に実行できた。)
hanako@myubuntu:~$ microk8s.status --wait-ready
microk8s is running
addons:
rbac: disabled
knative: disabled
ingress: disabled
dns: disabled
metrics-server: disabled
linkerd: disabled
prometheus: disabled
istio: disabled
jaeger: disabled
fluentd: disabled
gpu: disabled
cilium: disabled
storage: disabled
dashboard: disabled
registry: disabled
hanako@myubuntu:~$
  • ちゃんとNodeは動いてる
hanako@myubuntu:~$ microk8s.kubectl get nodes
NAME      STATUS   ROLES    AGE     VERSION
myubuntu   Ready    <none>   5m41s   v1.16.0
hanako@myubuntu:~$
hanako@myubuntu:~$ microk8s.kubectl get services
NAME         TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
kubernetes   ClusterIP   10.152.183.1   <none>        443/TCP   6m1s
hanako@myubuntu:~$

###エイリアス設定

  • microk8s.kubectlではなくkubectlでコマンドを実行したい場合は、エイリアスを設定する
hanako@myubuntu:~$ sudo snap alias microk8s.kubectl kubectl
[sudo] password for hanako:
Added:
  - microk8s.kubectl as kubectl
hanako@myubuntu:~$ kubectl config view
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://127.0.0.1:16443
  name: microk8s-cluster
contexts:
- context:
    cluster: microk8s-cluster
    user: admin
  name: microk8s
current-context: microk8s
kind: Config
preferences: {}
users:
- name: admin
  user:
    password: UzBDUi9Vbi9ObWJ5dnVCUjJLSlFDNXJsN1JBZXVvVllta0t0V05CckRrRT0K
    username: admin
hanako@myubuntu:~$

##感想

  • 本当に簡単に導入できるのでビックリした!
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?