Verify the OpenStack cloud provider after deployment

Verify the OpenStack cloud provider after deployment

After you enable the OpenStack cloud provider as described in Enable the OpenStack cloud provider and deploy it together with your Kubernetes cluster, verify that it has been successfully deployed using the procedure below.

To verify the OpenStack cloud provider:

  1. Log in to any Kubernetes Master node.

  2. Create a claim1.yaml file with the following content:

    kind: PersistentVolumeClaim
    apiVersion: v1
    metadata:
      name: claim1
    spec:
      storageClassName: cinder
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 1Gi
    
  3. Run the following command:

    kubectl apply -f claim1.yaml
    
  4. Create a cinder-test-rc.yaml file with the following content:

    apiVersion: v1
    kind: ReplicationController
    metadata:
      name: server
      labels:
        name: nginx
    spec:
      replicas: 1
      template:
        metadata:
          labels:
            name: nginx
        spec:
          containers:
          - name: server
            image: nginx
            volumeMounts:
              - mountPath: /var/lib/www/html
                name: cinderpvc
          volumes:
            - name: cinderpvc
              persistentVolumeClaim:
                claimName: claim1
    
  5. Run the following command:

    kubectl apply -f cinder-test-rc.yaml
    
  6. Verify that the volume was created:

    openstack volume list
    
  7. Verify that Neutron LBaaS can create the LoadBalancer objects:

    1. Create an nginx-rs.yml file with the following content:

      apiVersion: extensions/v1beta1
      kind: ReplicaSet
      metadata:
        name: nginx
      spec:
        replicas: 4
        template:
          metadata:
            labels:
              app: nginx
          spec:
            containers:
              - name: nginx
                image: nginx:1.10
                resources:
                  requests:
                    cpu: 100m
                    memory: 100Mi
      
    2. Run the following commands:

      kubectl create -f nginx-rs.yml
      kubectl expose rs nginx --port 80 --type=LoadBalancer
      
  8. Verify that the service has an external IP:

    kubectl get services -owide
    

    Example of system response:

    NAME       CLUSTER-IP    EXTERNAL-IP                  PORT(S)       AGE  SELECTOR
    kubernetes 10.254.0.1    <none>                       443/TCP       40m  <none>
    nginx      10.254.18.214 192.168.10.96,172.17.48.159  80:31710/TCP  1m   app=nginx
    
  9. Verify that LoadBalancer was created in OpenStack:

    neutron lbaas-loadbalancer-list
    

    In the output, the vip_address should match the first external IP for the service created.