ノート:

クイック・インストールを使用したOracle Cloud Native Environmentのデプロイ

イントロダクション

Oracle Cloud Native Environmentは、クラウド・ネイティブ・アプリケーションの開発および管理用に完全に統合されたスイートです。Kubernetesモジュールはコア・モジュールです。コンテナのデプロイおよび管理に使用され、CRI- O、runCおよびKataコンテナを自動的にインストールおよび構成します。CRI- Oは、Kubernetesクラスタのコンテナ・ランタイムを管理します。ランタイムは、runCまたはKataコンテナのいずれかです。

Oracle Cloud Native Environmentリリース1.5.7では、Oracle Cloud Native Environment Platform CLIを使用して、自体の迅速なインストールを実行する機能を導入しました。これは、インストールホスト(operatorノード)で olcnectl Provisioningコマンドを使用して行われます。olcnectl Provisioningコマンドは、ターゲットノード上で次の操作を実行できます。

このチュートリアルでは、Oracle Cloud Native EnvironmentおよびKubernetesクラスタをインストールできる最も単純なステップを使用して、クイック・インストールを実行する方法について説明します。このチュートリアルでは、プライベートCA証明書を使用します。独自のCA証明書を使用する本番環境ではお薦めします。

より複雑なインストール・トポロジを実現するには、独自のOracle Cloud Native Environment構成ファイルを作成し、- config- fileオプションを使用してolcnectl Provisioningコマンドに渡します。olcnectlプロビジョニングコマンドによって提供される構文オプションおよび構成ファイルの記述方法の詳細については、Platform Command- Line Interfaceガイドを参照してください。

目的

このラボでは、次の方法について説明します。

前提条件

このセクションでは、このチュートリアルの手順を実行するホストシステムを一覧表示します。成功するには、次が必要です。

演習環境の設定

ノート: 無料ラボ環境を使用する場合、接続およびその他の使用手順については、Oracle Linux Labの基本を参照してください。

この演習には複数のシステムが含まれており、各システムには異なるステップを実行する必要があります。ほとんどの操作は ocne- operatorノードから開始されるため、このノードの端末ウィンドウを最小限に抑えて開くことをお勧めします。

  1. 端末を開き、ssh経由で各ノードに接続します。

    ssh oracle@<ip_address_of_ol_node>
    

ノート演習でステップに「(すべてのノード上)」と表示されている場合は、ocne- operatorocne- controlおよびocne- workerに対してこれらのアクションを実行します。この方法の理由は、必要なアクションが各ノードで同一になるため、繰り返しを回避することです。

(オプション) Unbreakable Enterprise Kernel 7へのアップグレード(UEK7)

Oracle Cloud Native Environmentリリース1.5.7では、Oracle Linux 8 Unbreakable Enterprise Kernel 7のサポートが導入されたため、次のステップではこの新しいカーネル・バージョンにアップグレードする方法を示します。次の手順では、Oracle Linux 8 Update 6 UEK R6を使用して Unbreakable Enterprise Kernel 7 (UEK7)にラボ環境を更新する方法について説明します。

  1. (すべてのノードで)現在構成されているリポジトリを確認します。

    dnf repolist
    

    出力例:

    [oracle@ocne-operator ~]$ dnf repolist
    repo id                          repo name
    ol8_MySQL80                      MySQL 8.0 for Oracle Linux 8 (x86_64)
    ol8_MySQL80_connectors_community MySQL 8.0 Connectors Community for Oracle Linux 8 (x86_64)
    ol8_MySQL80_tools_community      MySQL 8.0 Tools Community for Oracle Linux 8 (x86_64)
    ol8_UEKR6                        Latest Unbreakable Enterprise Kernel Release 6 for Oracle Linux 8 (x86_64)
    ol8_addons                       Oracle Linux 8 Addons (x86_64)
    ol8_appstream                    Oracle Linux 8 Application Stream (x86_64)
    ol8_baseos_latest                Oracle Linux 8 BaseOS Latest (x86_64)
    
  2. (すべてのノードで) Unbreakable Enterpriose Kernelがインストールされていることを確認します

    dnf list installed kernel-uek
    

    出力例:

    [oracle@ocne-operator ~]$ dnf list installed kernel-uek
    Installed Packages
    kernel-uek.x86_64            5.4.17-2136.311.6.1.el8uek            @@commandline
    kernel-uek.x86_64            5.4.17-2136.312.3.4.el8uek            @ol8_UEKR6   
    kernel-uek.x86_64            5.4.17-2136.313.6.el8uek              @ol8_UEKR6  
    
  3. (すべてのノードで)新しい Unbreakable Enterprise Kernelを有効にし、古いカーネルを無効にします。

    sudo dnf config-manager --set-disabled ol8_UEKR6
    sudo dnf config-manager --set-enabled ol8_UEKR7
    
  4. (すべてのノードで)どの新しい Unbreakable Enterprise Kernelリポジトリが有効になったかを確認します。

    dnf repolist
    

    出力例:

    [oracle@ocne-operator ~]$ dnf repolist
    repo id                            repo name
    ol8_MySQL80                        MySQL 8.0 for Oracle Linux 8 (x86_64)
    ol8_MySQL80_connectors_community   MySQL 8.0 Connectors Community for Oracle Linux 8 (x86_64)
    ol8_MySQL80_tools_community        MySQL 8.0 Tools Community for Oracle Linux 8 (x86_64)
    ol8_UEKR7                          Latest Unbreakable Enterprise Kernel Release 7 for Oracle Linux 8 (x86_64)
    ol8_addons                         Oracle Linux 8 Addons (x86_64)
    ol8_appstream                      Oracle Linux 8 Application Stream (x86_64)
    ol8_baseos_latest                  Oracle Linux 8 BaseOS Latest (x86_64)
    
  5. (すべてのノードで)環境をアップグレードします。

    sudo dnf -y upgrade kernel-uek
    

    重要なノート: これは完了までに数分かかる場合があります。このステップが各ノードで個別にパラレルに実行された場合、時間を節約します。

  6. (すべてのノードで) Unbreakable Enterpriose Kernelがインストールされていることを確認します

    dnf list installed kernel-uek
    

    出力例:

    [oracle@ocne-operator ~]$ dnf list installed kernel-uek
    Installed Packages
    kernel-uek.x86_64            5.4.17-2136.311.6.1.el8uek            @@commandline
    kernel-uek.x86_64                              5.4.17-2136.312.3.4.el8uek                              @ol8_UEKR6
    kernel-uek.x86_64                              5.4.17-2136.313.6.el8uek                                @ol8_UEKR6
    kernel-uek.x86_64                              5.15.0-3.60.5.1.el8uek                                  @ol8_UEKR7
    
  7. (すべてのノードで)リブートして再接続します。

    sudo reboot
    
  8. (すべてのノード上)システムがリブートしたら、sshを使用してノードに再接続します。

    ssh oracle@<ip_address_of_ol_node>
    
  9. (すべてのノードで)新しいカーネルがインストールされていることを確認します。

    uname -a
    

    出力例:

    [oracle@ocne-worker ~]$ uname -a
    Linux ocne-worker 5.15.0-3.60.5.1.el8uek.x86_64 #2 SMP Wed Oct 19 20:04:48 PDT 2022 x86_64 x86_64 x86_64 GNU/Linux
    

Oracle Linux 8でのインストールホスト(Operatorノード)の設定

次のステップでは、Oracle Cloud Native Environmentのクイック・インストールに使用できるように、Oracle Linuxホスト(オペレータ・ノード)を構成します。

  1. (ocne- operator上で) oracle-olcne-release-el8リリースパッケージをインストールします。

    sudo dnf -y install oracle-olcne-release-el8
    
  2. (ocne- operatorで)現在のOracle Cloud Native Environmentリポジトリを有効にします。

    sudo dnf config-manager --enable ol8_olcne15 ol8_addons ol8_baseos_latest ol8_appstream ol8_kvm_appstream ol8_UEKR6
    

    重要なノート: (オプションの)ステップに従ってカーネルをUEK7にアップグレードした場合は、かわりに次のコマンドを使用します。

    sudo dnf config-manager --enable ol8_olcne15 ol8_addons ol8_baseos_latest ol8_appstream ol8_kvm_appstream ol8_UEKR7
    
  3. (ocne- operator上)以前のすべてのリポジトリバージョンを無効にします。

    sudo dnf config-manager --disable ol8_olcne14 ol8_olcne13 ol8_olcne12 ol8_developer
    
  4. (ocne- operator上で) olcnectlソフトウェアパッケージをインストールします。

    sudo dnf -y install olcnectl
    

クイックインストールの実行

次のステップでは、Oracle Cloud Native Environmentの基本的なデプロイメントを設定し、Kubernetesクラスタをインストールするための最速の方法について説明します。次の3つ以上のノードが必要です。

  1. (ocne- operator上で) olcnectl Provisioningコマンドを使用してインストールを開始します。

    olcnectl provision \
    --api-server ocne-operator \
    --master-nodes ocne-control \
    --worker-nodes ocne-worker \
    --environment-name myenvironment \
    --name mycluster
    

    重要なノート: この操作が完了するまで10分から15分かかる場合があり、終了するまで何も発生していることを示す表示はありません。

    場所:

    • - API- server - プラットフォームAPIを設定するノードのFQDN。
    • - master- nodes - Platform Agentで設定され、Kubernetesコントロール・プレーン・ロールが割り当てられるノードのFQDN。複数のノードが存在する場合は、カンマ区切りリストである必要があります。
    • - worker- nodes - プラットフォーム・エージェントで設定され、Kubernetesワーカー・ロールが割り当てられるノードのFQDN。複数のノードが存在する場合は、カンマ区切りリストである必要があります。
    • - environment- name - 環境の識別に使用されます。
    • - name - Kubernetesモジュールの名前を設定するために使用されます。

    ノートこのコマンドを実行すると、ホストに対して行われる変更をリストするプロンプトが表示され、確認を求められます。このプロンプトを回避するには、--yesオプションを使用します。このオプションは、確認プロンプトへの応答が肯定的(yes)であると想定するように olcnectl Provisioningコマンドを設定します。

    出力例: --yesコマンド・スイッチが使用されていない場合の出力例を次に示します。

    [oracle@ocne-operator ~]$ olcnectl provision --api-server ocne-operator --master-nodes ocne-control --worker-nodes ocne-worker --environment-name  myenvironment --name mycluster
    INFO[31/10/22 11:31:35] Generating certificate authority             
    INFO[31/10/22 11:31:35] Generating certificate for ocne-operator     
    INFO[31/10/22 11:31:35] Generating certificate for ocne-control      
    INFO[31/10/22 11:31:35] Generating certificate for ocne-worker       
    INFO[31/10/22 11:31:35] Creating directory "/etc/olcne/certificates/" on ocne-operator 
    INFO[31/10/22 11:31:35] Copying local file at "certificates/ca/ca.cert" to "/etc/olcne/certificates/ca.cert" on ocne-operator 
    INFO[31/10/22 11:31:35] Copying local file at "certificates/ocne-operator/node.cert" to "/etc/olcne/certificates/node.cert" on ocne-operator 
    INFO[31/10/22 11:31:35] Copying local file at "certificates/ocne-operator/node.key" to "/etc/olcne/certificates/node.key" on ocne-operator 
    INFO[31/10/22 11:31:35] Creating directory "/etc/olcne/certificates/" on ocne-control 
    The authenticity of host 'ocne-control (10.0.0.151)' can't be established.
    ECDSA key fingerprint is SHA256:NzPd6SBTbrcEgHoaYHY2bnDB357dfPysBXkJLuMVT98.
    Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
    INFO[31/10/22 11:31:49] Copying local file at "certificates/ca/ca.cert" to "/etc/olcne/certificates/ca.cert" on ocne-control 
    INFO[31/10/22 11:31:49] Copying local file at "certificates/ocne-control/node.cert" to "/etc/olcne/certificates/node.cert" on ocne-control
    INFO[31/10/22 11:31:50] Copying local file at "certificates/ocne-control/node.key" to "/etc/olcne/certificates/node.key" on ocne-control 
    INFO[31/10/22 11:31:50] Creating directory "/etc/olcne/certificates/" on ocne-worker 
    The authenticity of host 'ocne-worker (10.0.0.152)' can't be established.
    ECDSA key fingerprint is SHA256:FV6mTb92EBzV2SRYsdDFfNVYhlJe5s9rWBTPWgAL6VU.
    Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
    INFO[31/10/22 11:31:53] Copying local file at "certificates/ca/ca.cert" to "/etc/olcne/certificates/ca.cert" on ocne-worker 
    INFO[31/10/22 11:31:53] Copying local file at "certificates/ocne-worker/node.cert" to "/etc/olcne/certificates/node.cert" on ocne-worker 
    INFO[31/10/22 11:31:54] Copying local file at "certificates/ocne-worker/node.key" to "/etc/olcne/certificates/node.key" on ocne-worker 
    ? Apply api-server configuration on ocne-operator:
    * Install oracle-olcne-release
    * Enable olcne15 repo
    * Install API Server
        Add firewall port 8091/tcp
    
    Proceed? yes/no(default) yes
    ? Apply control-plane configuration on ocne-control:
    * Install oracle-olcne-release
    * Enable olcne15 repo
    * Configure firewall rule:
        Add interface cni0 to trusted zone
        Add ports: 8090/tcp 10250/tcp 10255/tcp 8472/udp 6443/tcp
    * Disable swap
    * Load br_netfilter module
    * Load Bridge Tunable Parameters:
        net.bridge.bridge-nf-call-ip6tables = 1
        net.bridge.bridge-nf-call-iptables = 1
        net.ipv4.ip_forward = 1
    * Set SELinux to permissive
    * Install and enable olcne-agent
    
    Proceed? yes/no(default) yes
    ? Apply worker configuration on ocne-worker:
    * Install oracle-olcne-release
    * Enable olcne15 repo
    * Configure firewall rule:
        Add interface cni0 to trusted zone
        Add ports: 8090/tcp 10250/tcp 10255/tcp 8472/udp
    * Disable swap
    * Load br_netfilter module
    * Load Bridge Tunable Parameters:
        net.bridge.bridge-nf-call-ip6tables = 1
        net.bridge.bridge-nf-call-iptables = 1
        net.ipv4.ip_forward = 1
    * Set SELinux to permissive
    * Install and enable olcne-agent
    
    Proceed? yes/no(default) yes
    INFO[31/10/22 11:41:48] Kubeconfig for instance "mycluster" in environment "myenvironment" written to kubeconfig.myenvironment.mycluster 
    
  2. (ocne- operator上) Oracle Cloud Native EnvironmentプラットフォームとKubernetesクラスタ・ソフトウェアがすべてのノードにインストールおよび構成されるようになりました。これを確認するには、次を使用します。

    olcnectl module instances \
    --api-server ocne-operator:8091 \
    --environment-name myenvironment
    

    出力例:

    [oracle@ocne-operator ~]$ olcnectl module instances --api-server ocne-operator:8091 --environment-name myenvironment
    INSTANCE         	MODULE    	STATE    
    ocne-worker:8090 	node      	installed
    mycluster        	kubernetes	installed
    ocne-control:8090	node      	installed
    
  3. (ocne- operatorで)将来の olcnectlコマンドで --api-serverフラグを使用する必要がないようにするには、--update-configフラグを追加して以前のコマンドを再度実行します。

    olcnectl module instances \
    --api-server ocne-operator:8091 \
    --environment-name myenvironment \
    --update-config
    
  4. (ocne- operatorの場合)配備に関するより詳細な情報は、olcnectl module reportコマンドを使用して取得できます。

    olcnectl module report \
    --environment-name myenvironment \
    --name mycluster \
    --children \
    --format yaml
    

    出力例:

    [oracle@ocne-operator ~]$ olcnectl module report --environment-name myenvironment --name mycluster  --children --format yaml
    Environments:
      myenvironment:
        ModuleInstances:
        - Name: mycluster
          Properties:
          - Name: kubectl
          - Name: cloud-provider
          - Name: kubecfg
            Value: file exist
    ...
          - Name: kubecfg
               Value: file exist
          - Name: selinux
            Value: permissive
          - Name: swap
            Value: "off"
    

    ノート: この出力を表形式で返すように出力を変更できます。ただし、この必要は、ターミナル・アプリケーションのエンコーディングをUTF-8に設定することです(ターミナル・アプリケーションのメニューで次を設定します: Terminal -> Set Encoding -> Unicode -> UTF-8)。その後、--format yamlオプションなしでコマンドを再度実行します。

    olcnectl module report \
    --environment-name myenvironment \
    --name mycluster \
    --children
    

    出力例:

    [oracle@ocne-operator ~]$ olcnectl module report --environment-name myenvironment --name mycluster --children
    ╭─────────────────────────────────────────────────────────────────────┬─────────────────────────╮
    │ myenvironment                                                       │                         │
    ├─────────────────────────────────────────────────────────────────────┼─────────────────────────┤
    │ mycluster                                                           │                         │
    ├─────────────────────────────────────────────────────────────────────┼─────────────────────────┤
    │ Property                                                            │ Current Value           │
    ├─────────────────────────────────────────────────────────────────────┼─────────────────────────┤
    │ podnetworking                                                       │ running                 │
    │ status_check                                                        │ healthy                 │
    │ cloud-provider                                                      │                         │
    │ kubecfg                                                             │ file exist              │
    │ externalip-webhook                                                  │ uninstalled             │
    │ extra-node-operations                                               │                         │
    │ extra-node-operations-update                                        │ running                 │
    │ kubectl                                                             │                         │
    │ master:ocne-control:8090                                            │                         │
    │ worker:ocne-worker:8090                                             │                         │
    ├─────────────────────────────────────────────────────────────────────┼─────────────────────────┤
    │ ocne-control:8090                                                   │                         │
    ├─────────────────────────────────────────────────────────────────────┼─────────────────────────┤
    ...
    ├─────────────────────────────────────────────────────────────────────┼─────────────────────────┤
    │ networking                                                          │ active                  │
    │ swap                                                                │ off                     │
    │ kubecfg                                                             │ file exist              │
    ╰─────────────────────────────────────────────────────────────────────┴─────────────────────────╯
    

kubectlの設定

  1. (ocne- controlで) kubectlコマンドを設定します。

    mkdir -p $HOME/.kube
    sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
    sudo chown $(id -u):$(id -g) $HOME/.kube/config
    export KUBECONFIG=$HOME/.kube/config
    echo 'export KUBECONFIG=$HOME/.kube/config' >> $HOME/.bashrc
    
  2. (ocne- controlの場合) kubectlが動作することを確認します。

    kubectl get nodes
    

    **出力例:

    [oracle@ocne-control ~]$ kubectl get nodes
    NAME           STATUS   ROLES           AGE   VERSION
    ocne-control   Ready    control-plane   26m   v1.24.5+1.el8
    ocne-worker    Ready    <none>          25m   v1.24.5+1.el8
    

    または

    kubectl get pods --all-namespaces
    

    出力例:

    [oracle@ocne-control ~]$ kubectl get pods --all-namespaces
    NAMESPACE              NAME                                    READY   STATUS    RESTARTS      AGE
    kube-system            coredns-664c775d6f-6gbcc                1/1     Running   0             26m
    kube-system            coredns-664c775d6f-dvht7                1/1     Running   0             26m
    kube-system            etcd-ocne-control                       1/1     Running   0             27m
    kube-system            kube-apiserver-ocne-control             1/1     Running   0             27m
    kube-system            kube-controller-manager-ocne-control    1/1     Running   1 (27m ago)   27m
    kube-system            kube-flannel-ds-cv9cl                   1/1     Running   0             26m
    kube-system            kube-flannel-ds-cxtz8                   1/1     Running   1 (25m ago)   26m
    kube-system            kube-proxy-cbm8s                        1/1     Running   0             26m
    kube-system            kube-proxy-rxkhb                        1/1     Running   0             26m
    kube-system            kube-scheduler-ocne-control             1/1     Running   0             27m
    

これにより、Oracle Cloud Native Environmentが3つのノードに設定され、稼働していることが確認されます。

詳細情報

その他の学習リソース

他のラボをdocs.oracle.com/learnで探すか、Oracle LearningのYouTubeチャネルでより無料の学習コンテンツにアクセスします。また、education.oracle.com/learning-explorerにアクセスしてOracle Learningエクスプローラになります。

製品のドキュメントは、Oracle Help Centerを参照してください。