Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Pre-requisite

The supported versions are as follows:

ONAP ReleaseRancherKubernetesHelmKubectlDocker
Amsterdam1.6.101.7.72.3.01.7.71.12.x

This is the amsterdam branch which has diffrent rancher/helm/kubernetes/docker version levels - for master use the latest defined in ONAP on Kubernetes#Registeryourhost

...

Helm Client: https://storage.googleapis.com/kubernetes-helm/helm-v2.1https://storage.googleapis.com/kubernetes-helm/helm-v2.3.0-linux-amd64.tar.gz3-linux-amd64.tar.gz

Code Block
wget https://storage.googleapis.com/kubernetes-helm/helm-v2.13.30-linux-amd64.tar.gz
tar -zxvf helm-v2.13.30-linux-amd64.tar.gz
sudo mv linux-amd64/helm /usr/local/bin/helm

...

  1. Create an environment
    1. Default → Managed Environments
    2. Click Add Environment
    3. Fill in the Name and the Description
    4. Select Kubernetes as Environment Template
    5. Click Create
  2. Create an API key: API → Keys
    1. Click Add Account API Key
    2. Fill in the Name and the Description
    3. Click Create
    4. Backup the Access Key and the Secret Key
  3. Retrieve your environment ID
    1. Navigate to the previously created environment
    2. In the browser URL, you should see the following, containing your <env-id>

      Code Block
      http://<rancher-vm-ip>:8080/env/<env-id>/kubernetes/dashboard
  4. Create the Kubernetes host on OpenStack.


    1. Using Rancher API
      Make sure to fill in the placeholder as follow:

      {API_ACCESS_KEY}: The API KEY created in the previous step
      {API_SECRET_KEY}: The API Secret created in the previous step
      {OPENSTACK_INSTANCE}: The OpenStack Instance Name to give to your K8S VM
      {OPENSTACK_IP}: The IP of your OpenStack deployment
      {RANCHER_IP}: The IP of the Rancher VM created previously
      {K8S_FLAVOR}: The Flavor to use for the kubernetes VM. Recommanded specs:

      VCPUs8
      RAM64Go
      Taille100Go
      Swap16Go

      I added some swap because in ONAP, most of the app are not always active, most of them are idle, so it's fine to let the host store dirty page in the swap memory.
      {UBUNTU_1604}: The Ubuntu 16.04 image
      {PRIVATE_NETWORK_NAME}: a private network
      {OPENSTACK_TENANT_NAME}: Openstack tenant
      {OPENSTACK_USERNAME}: Openstack username
      {OPENSTACK_PASSWORD}: OpenStack password

      Code Block
      curl -u "{API_ACCESS_KEY}:{API_SECRET_KEY}" \
      -X POST \
      -H 'Accept: application/json' \
      -H 'Content-Type: application/json' \
      -d '{
      "hostname":"{OPENSTACK_INSTANCE}",
      "engineInstallUrl":"wget https://raw.githubusercontent.com/rancher/install-docker/master/1.12.6.sh",
      "openstackConfig":{
          "authUrl":"http://{OPENSTACK_IP}:5000/v3",
          "domainName":"Default",
          "endpointType":"adminURL",
          "flavorName":"{K8S_FLAVOR}",
          "imageName":"{UBUNTU_1604}",
          "netName":"{PRIVATE_NETWORK_NAME}",
          "password":"{OPENSTACK_PASSWORD}",
          "sshUser":"ubuntu",
          "tenantName":"{OPENSTACK_TENANT_NAME}",
          "username":"{OPENSTACK_USERNAME}"}
      }' \
      'http://{RANCHER_IP}:8080/v2-beta/projects/{ENVIRONMENT_ID}/hosts/'
    2. Doing it manually
      1. Create a VM in your VIM with the appropriate specs (see point above)
      2. Provision it with docker: You can find the proper version of Docker to install here (for Rancher 1.6): http://rancher.com/docs/rancher/v1.6/en/hosts/#supported-docker-versions

      3. Go in Rancher, Infrastructure → Hosts and click the button Add Host. "Copy, paste, and run the command below to register the host with Rancher:”
  5. Let's wait a few minutes until it's ready.
  6. Get your kubectl config
    1. Click Kubernetes → CLI
    2. Click Generate Config
    3. Copy/Paste in your host, under

      Code Block
      ~/.kube/config

      If you have multiple Kubernetes environments, you can give it a different name, instead of config. Then reference all your kubectl config in your bash_profile as follow

      Code Block
      KUBECONFIG=\
      /Users/adetalhouet/.kube/k8s.adetalhouet1.env:\
      /Users/adetalhouet/.kube/k8s.adetalhouet2.env:\
      /Users/adetalhouet/.kube/k8s.adetalhouet3.env
      export KUBECONFIG
  7. Install kubectl

    Code Block
    curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.8.0/bin/linux/amd64/kubectl
    chmod +x ./kubectl
    sudo mv ./kubectl /usr/local/bin/kubectl
  8. Make your kubectl use this new environment

    Code Block
    kubectl config use-context <rancher-environment-name>
  9. After a little bit, your environment should be ready. To verify, use the following command

    Code Block
    $ kubectl get pods --all-namespaces
    NAMESPACE     NAME                                   READY     STATUS    RESTARTS   AGE
    kube-system   heapster-4285517626-4dst0              1/1       Running   0          4m
    kube-system   kube-dns-638003847-lx9f2               3/3       Running   0          4m
    kube-system   kubernetes-dashboard-716739405-f0kgq   1/1       Running   0          4m
    kube-system   monitoring-grafana-2360823841-0hm22    1/1       Running   0          4m
    kube-system   monitoring-influxdb-2323019309-4mh1k   1/1       Running   0          4m
    kube-system   tiller-deploy-737598192-8nb31          1/1       Running   0          4m

...