Create a ConfigMap Object

This section creates the sample ConfigMap. This ConfigMap contains the db.ini, the adminUser, and the schema.sql metadata files. This ConfigMap will be referenced when you define the TimesTenClassic object. See "Overview of Configuration Metadata and Kubernetes Facilities" for information on the configuration files and the ConfigMap facility.

On your Linux development host:

  1. From the directory of your choice, create an empty subdirectory for the metadata files. This example creates the cm_sample subdirectory. (The cm_sample directory is used in the remainder of this example to denote this directory.)
    % mkdir -p cm_sample
  2. Navigate to the ConfigMap directory.
    % cd cm_sample
  3. Create the db.ini file in this ConfigMap directory (cm_sample, in this example). In this db.ini file, define the PermSize and DatabaseCharacterSet connection attributes.
    vi db.ini
    
    PermSize=200
    DatabaseCharacterSet=AL32UTF8
  4. Create the adminUser file in this ConfigMap directory (cm_sample in this example). In this adminUser file, create the sampleuser user with the samplepw password.
    vi adminUser
    
    sampleuser/samplepw
  5. Create the schema.sql file in this ConfigMap directory (cm_sample in this example). In this schema.sql file, define the s sequence and the emp table for the sampleuser user. The Operator will automatically initialize your database with these object definitions.
    vi schema.sql
    
    create sequence sampleuser.s;
    create table sampleuser.emp (
      id number not null primary key,
      name char(32)
    );
  6. Create the ConfigMap. The files in the cm_sample directory are included in the ConfigMap and, later, will be available in the TimesTen containers.

    In this example:

    • The name of the ConfigMap is sample. Replace sample with a name of your choosing. (sample is represented in bold in this example.)

    • This example uses cm_sample as the directory where the files that will be copied into the ConfigMap reside. If you use a different directory, replace cm_sample with the name of your directory. (cm_sample is represented in bold in this example.)

    Use the kubectl create command to create the ConfigMap:

    % kubectl create configmap sample --from-file=cm_sample
    configmap/sample created

    You successfully created and deployed the sample ConfigMap.

  7. Use the kubectl describe command to verify the contents of the ConfigMap. (sample, in this example.)
    % kubectl describe configmap sample
    Name:         sample
    Namespace:    mynamespace
    Labels:       <none>
    Annotations:  <none>
     
    Data
    ====
    adminUser:
    ----
    sampleuser/samplepw
     
    db.ini:
    ----
    PermSize=200
    DatabaseCharacterSet=AL32UTF8
     
    schema.sql:
    ----
    create sequence sampleuser.s;
    create table sampleuser.emp (
      id number not null primary key,
      name char(32)
    );
     
     
    Events:  <none>