New American Standard Bible
Disciples’ Relation to Each Other
12 “This is My commandment, that you love one another, just as I have loved you. 13 Greater love has no one than this, that a person will lay down his life for his friends. 14 You are My friends if you do what I command you. 15 No longer do I call you slaves, for the slave does not know what his master is doing; but I have called you friends, because all things that I have heard from My Father I have made known to you.
Here, Jesus is looking forwards towards being crucified. He knows full well that he will at some point be somehow killed and that his death is very much impending.
But does he know that he’ll be raised? There is no indication of that here. Indeed he is basically saying good-bye to his disciples and leaving them with some final words for them to remember him by. So it doesn’t seem that way.
So maybe being resurrected was as big a surprise for Jesus as it was for everyone else? If he is being truly honest with his disciples here then I think that would be the case, as if he knew he’d be resurrected he’d have told them, as he says he is going to let them know everything he plans to do. I don’t think he was holding anything back from them, and I believe he knew he was going to die but not that he would be resurrected.
Edit: If you look up John 2:19-22 You will see that Jesus was in fact aware he was going to be put to death and then rise!
He is hinting that he is going to give up his life, for his friends.
“Friends” here could mean Jesus’s actual disciples, but I think it could be extended to cover all those who follow Jesus - past, present, and future.
Laying down his life thing is a reference to him taking the punishment for our sins by being nailed to the cross so we don’t have to be punished for them, and can therefore have eternal life
However: his friendship is conditional on us doing as he says. Which sounds a lot like a covenant: if you believe in him then you are one of his friends and his sacrifice covers your debts and it can be as though you never sinned and you can inherit eternal life. And if not, then you’re not covered by his sacrifice and “the wages of sin is death” (Romans 6:23)