Forum Discussion

  • To replace all the existing pool members in the pool

    pl
    with one of the existing nodes (
    CentOS-vmnet80
    here), run the following:

    curl -sku admin: https:///mgmt/tm/ltm/pool/pl \
      -X PATCH -H "Content-type: application/json" \
      -d '{
        "membersReference":{
          "items":[
            { "name":"CentOS-vmnet3:80","partition":"Common" }
          ]
        }
      }'
    

    The method also works for a pool with no member. Similarly, to replace all with new IP addresses:

     curl -sku admin: https:///mgmt/tm/ltm/pool/pl \
      -X PATCH -H "Content-type: application/json" \
      -d '{
        "membersReference":{
          "items":[
            {"name":"10.10.10.1:80"},
            {"name":"10.10.10.2:80"}
          ]
        }
      }'
    

    They work on all versions (tested on 12.1.3, 13.0.0 and 13.1.0).

    Note that the iControl REST calls above overwrite the existing pool members (irrespective of BIG-IP versions): i.e., they are equivalent to

    tmsh modify ltm pool pl members replace-all-with { ... }
    . No 'add' command is supported.

    If you want to do 'add', you need to first get the list of pool members, modify the list with additional member(s), and put that back to the pool. The following command will get you the list of the pool

    pl
    :

    curl -sku admin: https:///mgmt/tm/ltm/pool/pl/members
    
  • iControl REST does not support pool member 'add' (

    tmsh ltm pool  members add {}
    ) in any BIG-IP versions (to my knowledge). Load all the members, modify the list (add, delete, etc), and put it back.

  • I was wrong. You can

    add
    or
    delete
    a member to a pool.

    Add an existing node

    CentOS:80
    to the pool
    pl
    . Note that you need to use the port number not protocol name (e.g., http).

     tmsh modify ltm pool pl members add { CentOS:80 }
    
     curl -sku admin: https:///mgmt/tm/ltm/pool/pl/members \
      -X POST -H "Content-type: application/json" \
      -d '{"name":"CentOS:80", "partition":"Common"}'
    

    You can also add a member by specifying the IP address. If the node with that name does not exist, BIG-IP creates one for you (just like the equivalent tmsh command).

     tmsh modify ltm pool pl members add { 10.0.0.2:80 }
    
     curl -sku admin: https:///mgmt/tm/ltm/pool/pl/members \
      -X POST -H "Content-type: application/json" \
      -d '{"name":"10.0.0.2:80", "partition":"Common"}'
    

    Delete an existing pool member

    CentOS:80
    from the pool
    pl
    . Note that you need to explicitly specify the partition (in this example,
    Common
    ๐Ÿ˜ž

     tmsh modify ltm pool pl members delete { CentOS:80 }
    
     curl -sku admin: https:///mgmt/tm/ltm/pool/pl/members/~Common~CentOS:80 -X DELETE
    
  • Thanks Satoshi San for the thorough explanation (+1).

    I would like to add a equivalent for

    modify ltm pool <pool_name> members none

    By using PATCH with an empty list all pool members can be deleted, i.e.:

    curl -svk -u admin: -X PATCH -H 'Content-Type: application/json' -d '{"members": []}'  https://localhost/mgmt/tm/ltm/pool/pool_test_app001

    Instead of using the "membersReference":{"items":[{ "name":"<node-name>:<port>","partition":"<partition-name>" }]}

    syntax you may use the following one as well. It includes some additional parameters, i.e. (tested in TMOS v14.1.2):

    curl -svk -u admin: -X PATCH -H 'Content-Type: application/json' -d '{"members": [ {"name": "node_c:80", "address": "10.131.131.103", "session": "user-disabled"}, {"name": "node_d:80", "address": "10.131.131.104", "session": "user-disabled"}]}' https://localhost/mgmt/tm/ltm/pool/pool_test_app001

    Ideally we would have the ability to POST, PUT or PATCH on https://<hostname>/mgmt/tm/ltm/pool/<pool-name>/members level with lists of items (i.e. to add multiple pool members to existing ones in a single step). This can be done already in tmsh. Via API it seems like we have to add multiple members one by one.