The article considers problems of determining optimal shapes of compressed elastic rods under thermal loads. The functional to be maximized is taken to be the critical value of the temperature at which loss of stability occurs, while the desired control function is provided by the shape (thickness distribution) of the rod. The optimal solution is found for various types of rods, attachment conditions of their ends, and structural constraints.