Creo que esto te serviría:

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

    function onlyK(inputVal) {
      var patt=/^[Kk]+$/;
      if(patt.test(inputVal)){
        document.getElementById('txtK').value = inputVal;
      }
      else{
        var txt = inputVal.slice(0, -1);
        document.getElementById('txtK').value = txt;
      }
      
    }

<!-- language: lang-html -->

    <div class="form-group">
        <label class="form-text">Solo K</label>
        <input id="txtK" type="text" maxlength="1"
         oninput="onlyK(value)" />
     </div>

<!-- end snippet -->