It is best practice to ask the flight crew if you can take a picture of the cockpit. Several months ago I had a Captain get upset when I took a picture. I did ask the flight attendant if I could take a picture, and the flight attendant said it was fine. Be sure to ask the pilots if it's okay.