It's important to remember that in the Old Testament, God was giving the nation of Israel a law that they had to follow. The law they had to follow had blessings and curses based on how they, as a nation, followed the law. This is what we see throughout the whole Old Testament. God gives a law, the Israelites break it, he punishes them. Over and over and over again. So in the Old Testament, law paradigm, we find that a national fear of God in a theocracy is a very healthy and normal thing. It does, indeed, have to do with punishment.
There's a contrast however, once the Old Testament Law was fulfilled by Christ. He accomplished all that was in the law perfectly, doing everything the law required. Because he accomplished all that is within the law, satisfying God's demand for perfection, and because of his sacrifice, which he did not deserve and which was given for our freedom, we are no longer are bound by the law (Galatians 2:19, Romans 7:4). So we are no longer bound under the same fear that would have driven the Israelites in the Old Testament. Our fear is replaced by the confidence that Christ has already accomplished all that needs to be accomplished, and in his words, truly, "it is finished."
When we see that it is truly finished, that Christ accomplished the law, we see that we've been set free, and we are no longer accountable to the law on account of Christ's sacrifice on the cross. Being accountable to no law now frees us to release our fear and live instead in joy and gratitude.
1 Peter 2:17
As for the statement in 1 Peter 2:17, stating to fear God, it's important we see the whole context of this verse. Peter was just exhorting Christians to be subject to the laws in their land. This verse is a verse of contrasts, and the contrasts are put together in pairs:
Honor everyone - Love the brotherhood.
Fear God - Honor the emperor.
The statement here is drawing a contrast between how we ought to respond to those within the church and those outside the church, and also how we should respond to earthly leaders, in contrast to how we should respond to God.
We are to honor everyone, but we should love the brotherhood. That is, our first allegiance is to those within the church, and afterwards, we do our best to honor those who are outside the church. Likewise, our first allegiance is to God (hence the Fear God) part, but we should honor the emperor. While we seek to live at peace with everyone, Peter is laying out the priorities here by use of contrasting words. I'm not convinced he's saying that we are to live in abject fear of God, as though we are terrorized or afraid of his punishment. He's simply stating that our respect for God is over against that of the emperor, and likewise the needs of the members of the church is over against those not within the church. Note that in the verse before, he states that we are to live as people who are free, but not using our freedom as a cover-up for evil. He says nothing to the point of punishment if we do. The freedom is still ours, but his encouragement is that we use it properly.
We see a similar statement in Colossians 3:22:
Bondservants, obey in everything those who are your earthly masters,
not by way of eye-service, as people-pleasers, but with sincerity of
heart, fearing the Lord.
Again, here, he's saying that servants should fear the Lord and not be people pleasers. He's using the term fear in contrast to the term obey. Obey the earthly masters, but fear the Lord, not the other way around. Don't obey the Lord and fear your earthly masters. We should do things for the purpose of pleasing God, and not for the purpose of being seen by others.
On another note, another "fear" verse is Phillipians 2:12-13:
Therefore, my beloved, as you have always obeyed, so now, not only as
in my presence but much more in my absence, work out your own
salvation with fear and trembling, for it is God who works in you,
both to will and to work for his good pleasure.
So now we're saying to work out our salvation with fear and trembling? Why is this?
After salvation, the major focus of the Christian should continue to be to avoid falling into a legalistic frame of reference when it comes to living out the Christian life. To fall into a legalistic frame of reference is to be living by the law, and not by the Spirit. Doing this implicitly rejects the value of the cross, and is an implicit statement that what Christ has accomplished isn't enough, but that we have to add stuff to it. Our fear should be of minimizing the cross in that we fail to realize it's worth, not that we wouldn't perform everything according to the law properly, and thus get punished. In Christ, we won't.