How do you define German literature?
What do you mean by "you"? If you intend to collect some personal, individual convictions of German SE users who bother to write an answer - well, let's close this question as "primarily opinion-based". If, however, you want to address some unnamed community, assuming that their members agree on a definition of German literature - then, I am afraid, it depends. But let us first look on your second question.
Does the writer have to be a German citizen for their work to qualify as German literature...?
I think this can be answered - if it doesn't come with a specific temporal context - with a clear No. Simply for the lack of such a thing as "German citizenship" for long periods in history. This quote from the German Wikipedia article on Germany illustrates the problem quite well [emphasis mine]:
Nach der Niederlegung der Reichskrone 1806 dominierten das Kaisertum Österreich, das Königreich Preußen und der Rheinbund das staatliche Geschehen im Vorstellungsraum Deutschlands; nach 1815 folgte als die deutsche Nationalität sichernder Staatenbund der Deutsche Bund unter der Führung Österreichs.
"Germany" was then a term of the imaginative space, not of the real world. It's only since 1871 that we have a succession of political entities that can be called "Germany".
Now let's come back to "it depends". As you can see from the other answers and comments it depends on who you are asking ;-) But searching for references I mainly found indications that "Deutsche Literatur" is understood as "Deutschsprachige Literatur":
- German Wikipedia seems to treat "Deutsche Literatur" as synonym to "Deutschsprachige Literatur", both by redirection and by the introductory phrase.
- There is the term "Prager deutsche Literatur" (see here for a lengthy discussion in German about its definition) that is also referenced by the Franz Kafka society. The term would not make much sense if "deutsche Literatur" would normally be understood as "literature from Germany". I assume its creators would have explicitly used "Prager deutschsprachige Literatur" if they had seen a necessity for that.
- A couple of years ago a large anthology has been published under the title Kanon. Die deutsche Literatur. It also contains works by Austrian and Swiss authors - and Kafka. The title for sure is debatable, but I think it shows how the publishers expected the public to understand the term "Deutsche Literatur".
But there is also Austrian literature and Swiss literature - how do you call literature from Germany then? Well, in a context where it is clear that we are speaking about the contemporary literaric production of different countries: German literature. (Remember: it depends...) But ottherwise, you could explicitly specify the country you are referring to: "Literatur der Bundesrepublik Deutschland / DDR / Weimarer Republik / ...". And what would be the use of putting all these very different political entities in one set and contrasting it with other German speaking parts of the world? There simply has been much more continuity in what language the adjective "deutsch" is referring to that to which nationality, political entity or region.
tl;dr You can safely say that the works of Franz Kafka belong to German literature ("deutsche Literatur"), unless there is a clear context where German would be rather understood as a nationality or regional attribute. If you want to avoid any discussions, call them works of literature in German language.