JFK became president at the height of the Cold War. It began in 1947 with the Truman Doctrine containing the spread of communism and passage of the National Security Act, establishing the CIA, Department of Defense, the military’s Joint Chiefs of Staff, and the National Security Council. The following year National Security Directive 10-2 created the doctrine of Plausible Deniability, which enabled the CIA to disclaim responsibility for committing crimes of state.
Shortly after taking office, Kennedy was confronted with the Nixon-CIA-planned Bay of Pigs invasion. Its planners knew this Cuban-exile-led invasion would fail but did not tell JFK in order to get his approval for it.