仕事柄SDNについて扱うことがあり、今回はTungstenFabricについてまとめておきたいと思います。
https://github.com/Juniper/contrail-ansible-deployer
去年から活発に更新されていますが、改めて構築してみます。 今回はUbuntu18.04で挑戦してみます。
※ multi-nodeで実施する場合VirtualBoxでは内部ネットワーク使ったり、natネットワーク使ったり、CentOSのバージョン変えたりと色々試しましたが、ansibleが通っても、ネットワークとても不安定なので、all-in-oneで構築しない限りAWSやGCP使うのが賢明かも。アダプタの割り当てとか意外と神経使いますよね。
Ubuntu18.04
(All node) sudo su - (All node) apt update (Controller Node) apt install python-pip git -y (vRouter Node) apt install python -y (Controller Node) pip install ansible==2.4.2.0 requests (Controller Node) ssh-keygen (Controller Node) cd .ssh/ (Controller Node) cat id_rsa.pub >> authorized_keys (vRouter Node) vi .ssh/authorized_keys #Controller Nodeの .ssh/id_rsa.pubを追記してください (Controller Node) git clone -b R5.1 http://github.com/Juniper/contrail-ansible-deployer (Controller Node) cd contrail-ansible-deployer cat < 'EOF' > config/instances.yaml provider_config: bms: ssh_user: root ssh_public_key: /root/.ssh/id_rsa.pub ssh_private_key: /root/.ssh/id_rsa domainsuffix: local ntpserver: ntp.nict.jp instances: bms1: provider: bms ip: 172.31.28.202 # Controller Node IP roles: config_database: config: control: analytics: analytics_database: webui: k8s_master: kubemanager: openstack: bms11: provider: bms ip: 172.31.7.229 # vRouter Node IP roles: vrouter: k8s_node: openstack_compute: contrail_configuration: RABBITMQ_NODE_PORT: 5673 AUTH_MODE: keystone KEYSTONE_AUTH_URL_VERSION: /v3 CONTRAIL_CONTAINER_TAG: r5.1 KUBERNETES_CLUSTER_PROJECT: {} JVM_EXTRA_OPTS: "-Xms128m -Xmx1g" CONFIG_DATABASE_NODEMGR__DEFAULTS__minimum_diskGB: "2" DATABASE_NODEMGR__DEFAULTS__minimum_diskGB: "2" kolla_config: kolla_globals: kolla_internal_vip_address: 172.31.28.202 # Controller Node IP enable_ironic: no enable_haproxy: no enable_swift: no kolla_passwords: keystone_admin_password: contrail123 global_configuration: CONTAINER_REGISTRY: tungstenfabric EOF
time ansible-playbook -i inventory/ playbooks/configure_instances.yml -vvvv time ansible-playbook -i inventory/ playbooks/install_openstack.yml -vvvv time ansible-playbook -i inventory/ playbooks/install_k8s.yml -vvvv time ansible-playbook -i inventory/ playbooks/install_contrail.yml -vvvv
KubernetesのAnsibleで以下のようなエラーになった場合はall nodeでkubernetes-cni=0.6.0-00をインストールしてください kubelet : Depends: kubernetes-cni (= 0.6.0) but 0.7.5-00 is to be installed sudo apt install kubernetes-cni=0.6.0-00
Playbookは正常に回りましたが、Contrail Configのapiでエラーが・・・
# contrail-status == Contrail control == control: active nodemgr: active named: active dns: active == Contrail config-database == nodemgr: active zookeeper: active rabbitmq: active cassandra: active == Contrail kubernetes == kube-manager: active == Contrail database == nodemgr: active query-engine: active cassandra: active == Contrail analytics == nodemgr: active api: active collector: active == Contrail webui == web: active job: active == Contrail device-manager == == Contrail config == svc-monitor: active nodemgr: active device-manager: active api: initializing (Generic Connection:Keystone[] connection down) schema: active
docker exec -it config_api_1 tail -n100 /var/log/contrail/contrail-api.log ~snip~ 06/17/2019 07:54:35 AM [contrail-api] [ERROR]: Failed to resync: Unable to establish connection to http://127.0.0.1:35357/v3/auth/tokens ~snip~
色々不具合が重なって、Keystoneにアクセスできなくなってるのかな・・・
どうやらAnsible がUbuntu18.04から導入されたnetplanに対応していないため、結果なっているように見える。 次記事で詳細を記載したいと思います。 試しに16.04インストールしてみました。 手順は全く同じでやりました。
# contrail-status == Contrail control == control: active nodemgr: active named: active dns: active == Contrail config-database == nodemgr: active zookeeper: active rabbitmq: active cassandra: active == Contrail kubernetes == kube-manager: active == Contrail database == nodemgr: active query-engine: active cassandra: active == Contrail analytics == nodemgr: active api: active collector: active == Contrail webui == web: active job: active == Contrail device-manager == == Contrail config == svc-monitor: active nodemgr: active device-manager: active api: active schema: active #
なるほどnetplanが導入以前なので Ubuntu16.04だとうまくいくみたいですね。