Debian 11 Bullseye
Sponsored Link

MicroK8s : インストール2021/08/30

 
Canonical 社発の軽量 Kubernetes 環境 [MicroK8s] をインストールします。
[1] Snappy から MicroK8s をインストールします。
root@dlp:~#
apt -y install snapd sudo
root@dlp:~#
echo 'export PATH=/snap/bin:$PATH' >> ~/.bashrc

root@dlp:~#
source ~/.bashrc
root@dlp:~#
snap install microk8s --classic

microk8s (1.21/stable) v1.21.3 from Canonical✓ installed
[2] MicroK8s インストール後は、自動的に起動しています。停止や起動等は以下のように実行します。
# 現在の状態確認

root@dlp:~#
microk8s status

microk8s is running
high-availability: no
  datastore master nodes: 127.0.0.1:19001
  datastore standby nodes: none
addons:
  enabled:
    ha-cluster           # Configure high availability on the current node
  disabled:
    ambassador           # Ambassador API Gateway and Ingress
    cilium               # SDN, fast with full network policy
    dashboard            # The Kubernetes dashboard
    dns                  # CoreDNS
    fluentd              # Elasticsearch-Fluentd-Kibana logging and monitoring
    gpu                  # Automatic enablement of Nvidia CUDA
    helm                 # Helm 2 - the package manager for Kubernetes
    helm3                # Helm 3 - Kubernetes package manager
    host-access          # Allow Pods connecting to Host services smoothly
    ingress              # Ingress controller for external access
    istio                # Core Istio service mesh services
    jaeger               # Kubernetes Jaeger operator with its simple config
    keda                 # Kubernetes-based Event Driven Autoscaling
    knative              # The Knative framework on Kubernetes.
    kubeflow             # Kubeflow for easy ML deployments
    linkerd              # Linkerd is a service mesh for Kubernetes and other frameworks
    metallb              # Loadbalancer for your Kubernetes cluster
    metrics-server       # K8s Metrics Server for API access to service metrics
    multus               # Multus CNI enables attaching multiple network interfaces to pods
    openebs              # OpenEBS is the open-source storage solution for Kubernetes
    openfaas             # openfaas serverless framework
    portainer            # Portainer UI for your Kubernetes cluster
    prometheus           # Prometheus operator for monitoring and logging
    rbac                 # Role-Based Access Control for authorisation
    registry             # Private image registry exposed on localhost:32000
    storage              # Storage class; allocates storage from host directory
    traefik              # traefik Ingress controller for external access

# 現在の設定確認

root@dlp:~#
microk8s config

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tL.....
    server: https://10.0.0.30:16443
  name: microk8s-cluster
contexts:
- context:
    cluster: microk8s-cluster
    user: admin
  name: microk8s
current-context: microk8s
kind: Config
preferences: {}
users:
- name: admin
  user:
    token: b01qRS9UQUltN1p4bnF3c2Y0UkhiSlo2aWRJMFQ5V0lsMnFlNGpEYkx.....

root@dlp:~#
microk8s kubectl get all

NAME                 TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.152.183.1   <none>        443/TCP   5m4s

root@dlp:~#
microk8s kubectl get nodes

NAME            STATUS   ROLES    AGE     VERSION
dlp.srv.world   Ready    <none>   5m11s   v1.21.3-3+90fd5f3d2aea0a

# MicroK8s を停止する

root@dlp:~#
microk8s stop

Run service command "stop" for services ["daemon-apiserver" "daemon-apiserver-k...
Stopped.
root@dlp:~#
microk8s status

microk8s is not running, try microk8s start
# MicroK8s を開始する

root@dlp:~#
microk8s start

Started.
# MicroK8s を無効にする

root@dlp:~#
snap disable microk8s

microk8s disabled
# MicroK8s を有効にする

root@dlp:~#
snap enable microk8s

microk8s enabled
関連コンテンツ