Creating the Web Administration Tool Container

Use the following steps to create the Web Administration Tool container.

Procedure

  1. Ensure that the kubectl context is set to the correct environment.
    The mechanism differs based on the Kubernetes environment in use.
  2. Create a key that is used by the Web Administration Tool and add the new key to the ConfigMap that contains the configuration for the container.
    For example,
    openssl req -nodes -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 365; cat key.pem cert.pem > server.pem
  3. Create a ConfigMap definition file that is named webadmin-config.yaml.
    This definition file contains the configuration YAML for the container. For example,
    apiVersion: v1 
    kind: ConfigMap 
    metadata: 
      name: webadmin-config 
      namespace: default 
    data: 
      server.pem: |
        <insert-server.pem-here>
    
      config.yaml: |
        general: 
          ports:
            http:  0
            https: 9443
    
          license:
            key: "add-your-license-key-here"
            accept: standard
    
          ssl:
            cert-label: 'server-key'
            validate-hostname: false
      
        webadmin:
          servers:
          - label: my-ldap-server
            host: webadmin.ibm.com
            port: 9636
            secure: true
            admin-port: 0
    
        keyfile:
          keys:
          - label: 'server-key'
            key: "@/var/isvd/config/server.pem"
  4. Create the ConfigMap.
    kubectl create –f webadmin-config.yaml
  5. Create a deployment file that is named webadmin-container.yaml.
    This deployment file defines a Web Administration Tool container for your environment.
    # 
    # The deployment description of the Verify Directory webadmin container.
    #
    
    apiVersion: apps/v1
    kind: Deployment
    
    metadata:
      name: isvd-webadmin
      labels:
        app: isvd-webadmin
    
    spec:
      selector:
        matchLabels:
          app: isvd-webadmin
    
      template: 
        metadata:
          labels:
            app: isvd-webadmin
    
        spec:
          # The name of the service account which has the required
          # capabilities enabled for the isvd container.
          serviceAccountName: isvd
    
          # We use a volume to store the configuration for the 
          # environment.
          volumes:
          - name: config-volume
            configMap:
              name: webadmin-config
    
          containers:
          - name: isvd-webadmin
    
            # The fully qualified name of the image.
            image: icr.io/isvd/verify-directory-webadmin:latest
    
            # The port on which the container will be listening.
            ports:
            - containerPort: 9443
    
            # Environment definition.
            env:
            - name: YAML_CONFIG_FILE
              value: /var/isvd/config/config.yaml  
              
            # The configuration volume.
            volumeMounts:
            - name: config-volume
              mountPath: /var/isvd/config
    
            # The liveness, readiness and startup probes are used by
            # Kubernetes to monitor the health of the container.  Our 
            # health is governed by the health_check.sh script which is
            # provided by the container.
            livenessProbe:
              exec:
                command:
                - /sbin/health_check.sh 
                - livenessProbe
              initialDelaySeconds: 5
              periodSeconds: 10
    
            readinessProbe:
              exec:
                command:
                - /sbin/health_check.sh
              initialDelaySeconds: 5
              periodSeconds: 10 
    
            livenessProbe:
              exec:
                command:
                - /sbin/health_check.sh 
                - startupProbe
              initialDelaySeconds: 5
              periodSeconds: 10
  6. Create the container.
    kubectl create –f webadmin-container.yaml
  7. You can monitor the bootstrapping of the container that uses the logs command.
    kubectl logs -f `kubectl get -o json pods -l app=isvd-webadmin | jq -r .items[0].metadata.name`
  8. Create a configuration file that is named webadmin-service.yaml.
    This configuration file defines a service that can be used to access the Web Administration Tool. The type of service that is defined differs based on whether the 'load balancer' service type is supported in the environment.
    • If the 'load balancer' service type is not supported in your environment, the following definition can be used.

      # 
      # The service description of the Verify Directory Web Administration Tool
      # service.  This is the entry point into the environment and can be
      # accessed over port 30443 from outside of the Kubernetes cluster.
      #
      
      apiVersion: v1
      kind: Service
      
      metadata:
        name: isvd-webadmin
      
      spec:
        ports:
        - port: 9443
          name: isvd-webadmin
          protocol: TCP
          nodePort: 30443
      
        selector:
          app: isvd-webadmin
      
        type: NodePort
    • If the 'load balancer' service type is supported in your environment, the following definition can be used.
      
      # LoadBalancer service definition....
      apiVersion: v1
      kind: Service
      metadata:
        name: isvd-webadmin
      spec:
        type: LoadBalancer
        ports:
        - port: 443
        - targetPort: 9443
        selector:
          app: isvd-webadmin
  9. Create the service.
    kubectl create –f webadmin-service.yaml
  10. Determine the IP address.
    • If a LoadBalancer service was defined, determine the external IP address of the service, and then use your web browser to access the server (port 443).
       kubectl get service isvd-webadmin --watch
    • If a NodePort service was defined, determine the IP address of the Kubernetes cluster, and then use your web browser to access the server (port 30443).
    In a minikube environment, the IP address of the cluster can be obtained with the following command.
    minikube ip
    In an IBM cloud environment, the IP address of the cluster can be obtained with the following command.
    ibmcloud cs workers -c <cluster-name> --json | jq -r .[0].publicIP