<p>In working through a solution to one Stack Overflow <a href="https://stackoverflow.com/questions/62642774/interested-in-setting-up-k8s-cluster-on-ec2-instance-with-minikube-domain-name/62642907#62642907">post that I wrote</a>, I ran into a separate point of confusion. I'm not sure how to search for the answer to this question as there are too many potential pieces that I don't understand.</p>
<h2>Situation</h2>
<p>I want to run an Ingress controller on <code>hostNetwork</code> (for dev purposes). What I've learned so far is that I can create an Ingress controller with a config file like this:</p>
<pre><code>apiVersion: networking.k8s.io/v1beta1 # for versions before 1.14 use extensions/v1beta1
kind: Ingress
metadata:
  name: example-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1 
spec:
  rules:
  - http:
      paths:
      - path: /
        backend:
          serviceName: web 
          servicePort: 8080
</code></pre>
<p>It doesn't matter too much what <code>web</code> is other than it's a service running in my cluster.</p>
<p>In the question I linked to above, I'm instructed to &quot;Install nginx ingress controller and use hostNetwork: true in the deployment.yaml&quot;.</p>
<p>I haven't created a deployment.yaml for this project, but my understanding is that it's used for defining Pods, and how I want those pods to scale with replica sets.</p>
<h2>Question</h2>
<p>Are deployments used just for defining Pods (as is my current understanding) or can I also include my service/ingress in there? In either case, where would I define the <code>hostNetwork: true</code> directive? (NOTE: The purpose of all of this is to open up port 80 and point it towards my Ingress controller, so it doesn't seem correct that I'd just want to set <code>hostNetwork: true</code> on the Pods themselves.)</p>

wheresmycookie
<p>After you have installed nginx ingress controller there should be a deployment <code>ingress-nginx-controller</code> in namespace <code>ingress-nginx</code>. You need to modify the deployment. You can edit it using</p>
<pre><code>kubectl edit deploy ingress-nginx-controller -n ingress-nginx
</code></pre>
<p>and add <code>hostNetwork: true</code> in the pod spec section</p>
<pre><code>...
spec:
  hostNetwork: true
  containers:
    - name: controller
      image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.33.0
...
</code></pre>
