Kidney function is essential in dealing with the waste material from digested food and the working body. As kidney function worsens, it may be necessary to alter diet to reduce the problems caused by these substances accumulating. Control of diet is also necessary in patients on dialysis
The components of the Renal Diet are:
Protein and Calories
Phosphorus
Potassium
Sodium and Fluid

some patients with advanced kidney disease lose their appetite and risk becoming undernourished.
Protein
In the past a low protein diet was often recommended to slow down the steady deterioration of kidney function that occurs in some patients. We don't do this any more, instead recommending a moderate protein diet (not low, not high; 0.8-1g protein per kg of ideal body weight, if you like measuring).
Why not low protein?
Modern treatments, especially improved blood pressure treatments, have made any extra benefit from low protein diets much smaller.
Low protein diets don't taste good, and this may lead you to go short on calories too.
There is a significant risk of long-term malnutrition in those on low-protein diets
Why not high protein?
High protein intake in CKD makes the body more acid, and this can lead to increased muscle breakdown.
High protein intake means high phosphate intake too
In animals and probably humans, large amounts of protein may damage kidneys
Sodium (salt)
Common salt is sodium chloride. Keeping the amount you eat down is important for almost all patients with kidney disease, even at early stages. Too much salt causes high blood pressure and fluid retention .Many blood pressure tablets only work properly if combined with a reduced salt intake.
Potassium
Potassium should not be restricted routinely, as it is present in many very healthy foods, but this is sometimes necessary when kidney function has become very poor. High potassium levels are very dangerous but usually only a problem in advanced kidney disease. Some unlucky people need to restrict potassium at milder levels of kidney failure.
Hyperkalaemia (too much potassium in the blood) can have other causes apart from eating too much potassium. For example some medicines, such as ACE inhibitors (drugs with a name ending -ipril) and ARBs (ending -sartan) raise blood potassium, and there can be other reasons. In some patients it may be better to continue the drug and watch your potassium intake, as these drugs can protect the kidneys particularly well
Fluid (liquid)

Until end-stage is reached most patients benefit from maintaining a normal fluid intake (e.g. 1.5-2 litres daily). You should drink when you are thirsty, and avoid dehydration, which is bad for kidney function. However some patients have to limit their drinking when kidney function becomes poor (fluid restriction).
Phosphate
Hyperphosphataemia, too much phosphate in the blood, is usually only a problem in the later stages of renal failure, although phosphate retention occurs long before it shows up in raised blood levels.
Avoiding excess protein limits the amount of phosphate in the diet too, and there are some foods that can be limited if the level of phosphate in blood rises. However in advanced kidney failure most people require phosphate binding medication before meals. This works by binding phosphate in the gut and preventing it from being absorbed into the body. It is therefore important that it is taken with or just before food. These are medicines such as calcium acetate and Renagel, for example.
Energy
Too few calories leads to the breakdown of muscle to provide energy - this is a sign of malnutrition and contributes to make patients more prone to infections.
It is very important to eat enough food to provide the body with adequate calories so these needs can be met. If your diet is inadequate in calories, the body’s protein stores will be broken down and used to provide the needed energy. T
his process releases the same waste product, urea, as excess protein ingestion. It also results in loss of weight, muscle mass, and strength.
As kidney failure gets worse, people tend to eat less, and poor nutrition can become a major problem. Sometimes it is necessary to provide dietary supplements if the patient can't eat enough. More info about undernutrition and energy intake.
Diabetes and Chronic renal failure
This is a common combination and renal dietitians will be familiar with the problems.