How do we learn to be obedient? As a child, when we are disobedient, we get in trouble and have punishments. Those can range from more chores to timeout to anything in between. See what Hebrews 5 says about Jesus and obedience.
Although He was a Son, He learned obedience from the things which He suffered.
Hebrews 5:8 NASB
Jesus learned obedience through suffering. He came to understand and obey because of the things that he suffered in His life. If Jesus learned obedience through suffering, how do we expect to learn except through suffering as well. God knows what he is allowing us to go through in our lives, and it is often so that we will have a better understanding of who he is, which will result in us loving him more and obeying him more freely. Are we seeking to learn him more and obey him more? Are we learning the lessons that God has for us in the situations that he brings us through in our lives?