One of the better examples of John Lennon's tendency towards self-reference in his songs (see also "All you need is love
He references "Strawberry Fields Forever," "I Am the Walrus," "Lady Madonna," "The Fool on the Hill," and "Fixing a Hole."
The line "the walrus was Paul" is said to be one of the three clues in the song that Paul is dead, as the walrus is said to be a sign of death in Greek culture. The other references are to the dovetail joint, which is said to be used in casket-making (However, I've seen dovetail joints in many other items. A dovetail joint is the strongest joint there is, not needing nails to hold it together, and I see it as more John's comment on the band falling apart), and to the "glass onion," said to be a coffin with a glass lid.
However, a glass onion is an old term for the astronomical concept of the earth-centered universe. The stars and planets were all fixed in crystle spheres surrounding the earth like the layers of an onion.