<p>I accidentally deleted the kubernetes svc:</p>

<pre><code>service "kubernetes" deleted
</code></pre>

<p>using:</p>

<pre><code> kubectl delete svc --all
</code></pre>

<p>what should I do? I was just trying to remove services so I could launch new ones.</p>

<p>A bit theory first ;) 
Whenever you delete kubernetes svc, you also delete endpoint and this is where 
<a href="https://github.com/kubernetes/kubernetes/blob/master/pkg/master/controller.go#L276" rel="noreferrer">Reconciler</a> comes in. It is actually a controller manager for the core bootstrap Kubernetes controller loops, which manage creating the "<strong>kubernetes</strong>" service, the
"<strong>default</strong>", "<strong>kube-system</strong>" and "<strong>kube-public</strong>" namespaces, and provide the IP repair check on service IPs. </p>

<p>So, in healthy clusters <strong>default.kubernetes</strong> service should be automatically recreated by controller manager.</p>

<p>If it's not, I'd recommend to:</p>

<p>Check api-server logs</p>

<pre><code>kubectl logs -f kube-apiserver-master -n kube-system
</code></pre>

<p>You should see something like:</p>

<pre><code>Resetting endpoints for master service "kubernetes" to [10.156.0.3]
</code></pre>

<p>If you don't see it, try to manually remove etcd key for this service</p>

<p>Because the current state of the cluster is stored in etcd, it may happen that the key remain when you deleted a service:</p>

<p>a. exec to etcd-master pods</p>

<pre><code>kubectl exec -it etcd-master -n kube-system sh
</code></pre>

<p>b. get the etcd key value</p>

<pre><code>ETCDCTL_API=3 etcdctl --cacert=/etc/kubernetes/pki/etcd/ca.crt --key=/etc/kubernetes/pki/etcd/server.key --cert=/etc/kubernetes/pki/etcd/server.crt get /registry/services/endpoints/default/kubernetes
</code></pre>

<p>c. if you get any value like:</p>

<pre><code>v1    Endpointst
O

kubernetesdefault"*$eafc04cf-90f3-11e9-a75e-42010a9c00032����z!


10.156.0.3
https�2TCP"
</code></pre>

<p>just remove it by </p>

<pre><code>ETCDCTL_API=3 etcdctl --cacert=/etc/kubernetes/pki/etcd/ca.crt --key=/etc/kubernetes/pki/etcd/server.key --cert=/etc/kubernetes/pki/etcd/server.crt rm /registry/services/endpoints/default/kubernetes
</code></pre>

<p>After you did it, check the api-server logs once again. </p>
