diff --git a/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/cli/K8sIngressListCommand.java b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/cli/K8sIngressListCommand.java
new file mode 100644
index 0000000..8003e28
--- /dev/null
+++ b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/cli/K8sIngressListCommand.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2019-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.k8snetworking.cli;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.collect.Lists;
+import io.fabric8.kubernetes.api.model.extensions.Ingress;
+import io.fabric8.kubernetes.client.utils.Serialization;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.k8snetworking.api.K8sIngressService;
+
+import java.io.IOException;
+import java.util.Comparator;
+import java.util.List;
+
+import static org.onosproject.k8snetworking.util.K8sNetworkingUtil.prettyJson;
+
+/**
+ * Lists kubernetes ingresses.
+ */
+@Service
+@Command(scope = "onos", name = "k8s-ingresses",
+        description = "Lists all kubernetes ingresses")
+public class K8sIngressListCommand extends AbstractShellCommand {
+
+    private static final String FORMAT = "%-50s%-15s%-30s";
+
+    @Override
+    protected void doExecute() {
+        K8sIngressService service = get(K8sIngressService.class);
+        List<Ingress> ingresses = Lists.newArrayList(service.ingresses());
+        ingresses.sort(Comparator.comparing(p -> p.getMetadata().getName()));
+
+        if (outputJson()) {
+            print("%s", json(ingresses));
+        } else {
+            print(FORMAT, "Name", "Namespace", "LB Addresses");
+
+            for (Ingress ingress : ingresses) {
+
+                List<String> lbIps = Lists.newArrayList();
+
+                ingress.getStatus().getLoadBalancer()
+                        .getIngress().forEach(i -> lbIps.add(i.getIp()));
+
+                print(FORMAT,
+                        ingress.getMetadata().getName(),
+                        ingress.getMetadata().getNamespace(),
+                        lbIps.isEmpty() ? "" : lbIps);
+            }
+        }
+    }
+
+    private String json(List<Ingress> ingresses) {
+        ObjectMapper mapper = new ObjectMapper();
+        ArrayNode result = mapper.createArrayNode();
+        try {
+            for (Ingress ingress : ingresses) {
+                ObjectNode json = (ObjectNode) new ObjectMapper()
+                        .readTree(Serialization.asJson(ingress));
+                result.add(json);
+            }
+            return prettyJson(mapper, result.toString());
+        } catch (IOException e) {
+            log.warn("Failed to parse ingress's JSON string.");
+            return "";
+        }
+    }
+}
diff --git a/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/cli/K8sSyncStateCommand.java b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/cli/K8sSyncStateCommand.java
index 170425c..9b16795 100644
--- a/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/cli/K8sSyncStateCommand.java
+++ b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/cli/K8sSyncStateCommand.java
@@ -18,6 +18,7 @@
 import com.google.common.collect.Lists;
 import io.fabric8.kubernetes.api.model.Endpoints;
 import io.fabric8.kubernetes.api.model.Pod;
+import io.fabric8.kubernetes.api.model.extensions.Ingress;
 import io.fabric8.kubernetes.client.KubernetesClient;
 import org.apache.karaf.shell.api.action.Command;
 import org.apache.karaf.shell.api.action.lifecycle.Service;
@@ -26,6 +27,7 @@
 import org.onosproject.cli.AbstractShellCommand;
 import org.onosproject.k8snetworking.api.DefaultK8sPort;
 import org.onosproject.k8snetworking.api.K8sEndpointsAdminService;
+import org.onosproject.k8snetworking.api.K8sIngressAdminService;
 import org.onosproject.k8snetworking.api.K8sNetworkAdminService;
 import org.onosproject.k8snetworking.api.K8sPodAdminService;
 import org.onosproject.k8snetworking.api.K8sPort;
@@ -52,6 +54,7 @@
     private static final String POD_FORMAT = "%-50s%-15s%-15s%-30s";
     private static final String SERVICE_FORMAT = "%-50s%-30s%-30s";
     private static final String ENDPOINTS_FORMAT = "%-50s%-50s%-20s";
+    private static final String INGRESS_FORMAT = "%-50s%-15s%-30s";
 
     private static final String PORT_ID = "portId";
     private static final String DEVICE_ID = "deviceId";
@@ -66,6 +69,8 @@
         K8sPodAdminService podAdminService = get(K8sPodAdminService.class);
         K8sServiceAdminService serviceAdminService =
                 get(K8sServiceAdminService.class);
+        K8sIngressAdminService ingressAdminService =
+                get(K8sIngressAdminService.class);
         K8sEndpointsAdminService endpointsAdminService =
                 get(K8sEndpointsAdminService.class);
         K8sNetworkAdminService networkAdminService =
@@ -120,6 +125,31 @@
 
             printPod(pod);
         });
+
+        print("\nSynchronizing kubernetes ingresses");
+        print(INGRESS_FORMAT, "Name", "Namespace", "LB Addresses");
+        client.extensions().ingresses().list().getItems().forEach(ingress -> {
+            if (ingressAdminService.ingress(ingress.getMetadata().getUid()) != null) {
+                ingressAdminService.updateIngress(ingress);
+            } else {
+                ingressAdminService.createIngress(ingress);
+            }
+            printIngresses(ingress);
+        });
+
+    }
+
+    private void printIngresses(Ingress ingress) {
+
+        List<String> lbIps = Lists.newArrayList();
+
+        ingress.getStatus().getLoadBalancer()
+                .getIngress().forEach(i -> lbIps.add(i.getIp()));
+
+        print(INGRESS_FORMAT,
+                ingress.getMetadata().getName(),
+                ingress.getMetadata().getNamespace(),
+                lbIps.isEmpty() ? "" : lbIps);
     }
 
     private void printEndpoints(Endpoints endpoints) {
diff --git a/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/impl/DistributedK8sIngressStore.java b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/impl/DistributedK8sIngressStore.java
new file mode 100644
index 0000000..c6a0f49
--- /dev/null
+++ b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/impl/DistributedK8sIngressStore.java
@@ -0,0 +1,193 @@
+/*
+ * Copyright 2019-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.k8snetworking.impl;
+
+import com.google.common.collect.ImmutableSet;
+import io.fabric8.kubernetes.api.model.LoadBalancerIngress;
+import io.fabric8.kubernetes.api.model.LoadBalancerStatus;
+import io.fabric8.kubernetes.api.model.ObjectMeta;
+import io.fabric8.kubernetes.api.model.extensions.Ingress;
+import io.fabric8.kubernetes.api.model.extensions.IngressBackend;
+import io.fabric8.kubernetes.api.model.extensions.IngressRule;
+import io.fabric8.kubernetes.api.model.extensions.IngressSpec;
+import io.fabric8.kubernetes.api.model.extensions.IngressStatus;
+import io.fabric8.kubernetes.api.model.extensions.IngressTLS;
+import org.onlab.util.KryoNamespace;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
+import org.onosproject.k8snetworking.api.K8sIngressEvent;
+import org.onosproject.k8snetworking.api.K8sIngressStore;
+import org.onosproject.k8snetworking.api.K8sIngressStoreDelegate;
+import org.onosproject.store.AbstractStore;
+import org.onosproject.store.serializers.KryoNamespaces;
+import org.onosproject.store.service.ConsistentMap;
+import org.onosproject.store.service.MapEvent;
+import org.onosproject.store.service.MapEventListener;
+import org.onosproject.store.service.Serializer;
+import org.onosproject.store.service.StorageService;
+import org.onosproject.store.service.Versioned;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
+import org.slf4j.Logger;
+
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.concurrent.Executors.newSingleThreadExecutor;
+import static org.onlab.util.Tools.groupedThreads;
+import static org.onosproject.k8snetworking.api.K8sIngressEvent.Type.K8S_INGRESS_CREATED;
+import static org.onosproject.k8snetworking.api.K8sIngressEvent.Type.K8S_INGRESS_REMOVED;
+import static org.onosproject.k8snetworking.api.K8sIngressEvent.Type.K8S_INGRESS_UPDATED;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Implementation of kubernetes ingress store using consistent map.
+ */
+@Component(immediate = true, service = K8sIngressStore.class)
+public class DistributedK8sIngressStore
+        extends AbstractStore<K8sIngressEvent, K8sIngressStoreDelegate>
+        implements K8sIngressStore {
+
+    private final Logger log = getLogger(getClass());
+
+    private static final String ERR_NOT_FOUND = " does not exist";
+    private static final String ERR_DUPLICATE = " already exists";
+    private static final String APP_ID = "org.onosproject.k8snetwork";
+
+    private static final KryoNamespace
+        SERIALIZER_K8S_INGRESS = KryoNamespace.newBuilder()
+            .register(KryoNamespaces.API)
+            .register(Ingress.class)
+            .register(ObjectMeta.class)
+            .register(IngressSpec.class)
+            .register(IngressStatus.class)
+            .register(IngressBackend.class)
+            .register(IngressRule.class)
+            .register(IngressTLS.class)
+            .register(LoadBalancerStatus.class)
+            .register(LoadBalancerIngress.class)
+            .build();
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
+    protected CoreService coreService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
+    protected StorageService storageService;
+
+    private final ExecutorService eventExecutor = newSingleThreadExecutor(
+            groupedThreads(this.getClass().getSimpleName(), "event-handler", log));
+
+    private final MapEventListener<String, Ingress> ingressMapListener = new K8sIngressMapListener();
+    private ConsistentMap<String, Ingress> ingressStore;
+
+    @Activate
+    protected void activate() {
+        ApplicationId appId = coreService.registerApplication(APP_ID);
+        ingressStore = storageService.<String, Ingress>consistentMapBuilder()
+                .withSerializer(Serializer.using(SERIALIZER_K8S_INGRESS))
+                .withName("k8s-ingress-store")
+                .withApplicationId(appId)
+                .build();
+
+        ingressStore.addListener(ingressMapListener);
+        log.info("Started");
+    }
+
+    @Deactivate
+    protected void deactivate() {
+        ingressStore.removeListener(ingressMapListener);
+        eventExecutor.shutdown();
+        log.info("Stopped");
+    }
+
+    @Override
+    public void createIngress(Ingress ingress) {
+        ingressStore.compute(ingress.getMetadata().getUid(), (uid, existing) -> {
+            final String error = ingress.getMetadata().getUid() + ERR_DUPLICATE;
+            checkArgument(existing == null, error);
+            return ingress;
+        });
+    }
+
+    @Override
+    public void updateIngress(Ingress ingress) {
+        ingressStore.compute(ingress.getMetadata().getUid(), (uid, existing) -> {
+            final String error = ingress.getMetadata().getUid() + ERR_NOT_FOUND;
+            checkArgument(existing != null, error);
+            return ingress;
+        });
+    }
+
+    @Override
+    public Ingress removeIngress(String uid) {
+        Versioned<Ingress> ingress = ingressStore.remove(uid);
+        if (ingress == null) {
+            final String error = uid + ERR_NOT_FOUND;
+            throw new IllegalArgumentException(error);
+        }
+        return ingress.value();
+    }
+
+    @Override
+    public Ingress ingress(String uid) {
+        return ingressStore.asJavaMap().get(uid);
+    }
+
+    @Override
+    public Set<Ingress> ingresses() {
+        return ImmutableSet.copyOf(ingressStore.asJavaMap().values());
+    }
+
+    @Override
+    public void clear() {
+        ingressStore.clear();
+    }
+
+    private class K8sIngressMapListener implements MapEventListener<String, Ingress> {
+
+        @Override
+        public void event(MapEvent<String, Ingress> event) {
+
+            switch (event.type()) {
+                case INSERT:
+                    log.debug("Kubernetes ingress created {}", event.newValue());
+                    eventExecutor.execute(() ->
+                            notifyDelegate(new K8sIngressEvent(
+                                    K8S_INGRESS_CREATED, event.newValue().value())));
+                    break;
+                case UPDATE:
+                    log.debug("Kubernetes ingress updated {}", event.newValue());
+                    eventExecutor.execute(() ->
+                            notifyDelegate(new K8sIngressEvent(
+                                    K8S_INGRESS_UPDATED, event.newValue().value())));
+                    break;
+                case REMOVE:
+                    log.debug("Kubernetes ingress removed {}", event.oldValue());
+                    eventExecutor.execute(() ->
+                            notifyDelegate(new K8sIngressEvent(
+                                    K8S_INGRESS_REMOVED, event.oldValue().value())));
+                    break;
+                default:
+                    // do nothing
+                    break;
+            }
+        }
+    }
+}
diff --git a/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/impl/K8sIngressManager.java b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/impl/K8sIngressManager.java
new file mode 100644
index 0000000..037ff0c
--- /dev/null
+++ b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/impl/K8sIngressManager.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2019-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.k8snetworking.impl;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableSet;
+import io.fabric8.kubernetes.api.model.extensions.Ingress;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
+import org.onosproject.event.ListenerRegistry;
+import org.onosproject.k8snetworking.api.K8sIngressAdminService;
+import org.onosproject.k8snetworking.api.K8sIngressEvent;
+import org.onosproject.k8snetworking.api.K8sIngressListener;
+import org.onosproject.k8snetworking.api.K8sIngressService;
+import org.onosproject.k8snetworking.api.K8sIngressStore;
+import org.onosproject.k8snetworking.api.K8sIngressStoreDelegate;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
+import org.slf4j.Logger;
+
+import java.util.Set;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.onosproject.k8snetworking.api.Constants.K8S_NETWORKING_APP_ID;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Provides implementation of administering and interfacing kubernetes ingress.
+ */
+@Component(
+        immediate = true,
+        service = {K8sIngressAdminService.class, K8sIngressService.class}
+)
+public class K8sIngressManager
+        extends ListenerRegistry<K8sIngressEvent, K8sIngressListener>
+        implements K8sIngressAdminService, K8sIngressService {
+
+    protected final Logger log = getLogger(getClass());
+
+    private static final String MSG_INGRESS = "Kubernetes ingress %s %s";
+    private static final String MSG_CREATED = "created";
+    private static final String MSG_UPDATED = "updated";
+    private static final String MSG_REMOVED = "removed";
+
+    private static final String ERR_NULL_INGRESS  = "Kubernetes ingress cannot be null";
+    private static final String ERR_NULL_INGRESS_UID  = "Kubernetes ingress UID cannot be null";
+
+    private static final String ERR_IN_USE = " still in use";
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
+    protected CoreService coreService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
+    protected K8sIngressStore k8sIngressStore;
+
+    private final K8sIngressStoreDelegate delegate = new InternalIngressStorageDelegate();
+
+    private ApplicationId appId;
+
+    @Activate
+    protected void activate() {
+        appId = coreService.registerApplication(K8S_NETWORKING_APP_ID);
+
+        k8sIngressStore.setDelegate(delegate);
+        log.info("Started");
+    }
+
+    @Deactivate
+    protected void deactivate() {
+        k8sIngressStore.unsetDelegate(delegate);
+        log.info("Stopped");
+    }
+
+    @Override
+    public void createIngress(Ingress ingress) {
+        checkNotNull(ingress, ERR_NULL_INGRESS);
+        checkArgument(!Strings.isNullOrEmpty(ingress.getMetadata().getUid()),
+                ERR_NULL_INGRESS_UID);
+
+        k8sIngressStore.createIngress(ingress);
+
+        log.info(String.format(MSG_INGRESS, ingress.getMetadata().getName(), MSG_CREATED));
+    }
+
+    @Override
+    public void updateIngress(Ingress ingress) {
+        checkNotNull(ingress, ERR_NULL_INGRESS);
+        checkArgument(!Strings.isNullOrEmpty(ingress.getMetadata().getUid()),
+                ERR_NULL_INGRESS_UID);
+
+        k8sIngressStore.updateIngress(ingress);
+
+        log.info(String.format(MSG_INGRESS, ingress.getMetadata().getName(), MSG_UPDATED));
+    }
+
+    @Override
+    public void removeIngress(String uid) {
+        checkArgument(!Strings.isNullOrEmpty(uid), ERR_NULL_INGRESS_UID);
+
+        synchronized (this) {
+            if (isIngressInUse(uid)) {
+                final String error = String.format(MSG_INGRESS, uid, ERR_IN_USE);
+                throw new IllegalStateException(error);
+            }
+
+            Ingress ingress = k8sIngressStore.removeIngress(uid);
+
+            if (ingress != null) {
+                log.info(String.format(MSG_INGRESS,
+                        ingress.getMetadata().getName(), MSG_REMOVED));
+            }
+        }
+    }
+
+    @Override
+    public void clear() {
+        k8sIngressStore.clear();
+    }
+
+    @Override
+    public Ingress ingress(String uid) {
+        checkArgument(!Strings.isNullOrEmpty(uid), ERR_NULL_INGRESS_UID);
+        return k8sIngressStore.ingress(uid);
+    }
+
+    @Override
+    public Set<Ingress> ingresses() {
+        return ImmutableSet.copyOf(k8sIngressStore.ingresses());
+    }
+
+    private boolean isIngressInUse(String uid) {
+        return false;
+    }
+
+    private class InternalIngressStorageDelegate implements K8sIngressStoreDelegate {
+
+        @Override
+        public void notify(K8sIngressEvent event) {
+            if (event != null) {
+                log.trace("send kubernetes ingress event {}", event);
+                process(event);
+            }
+        }
+    }
+}
diff --git a/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/impl/K8sIngressWatcher.java b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/impl/K8sIngressWatcher.java
new file mode 100644
index 0000000..e640fcc
--- /dev/null
+++ b/apps/k8s-networking/app/src/main/java/org/onosproject/k8snetworking/impl/K8sIngressWatcher.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2019-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.k8snetworking.impl;
+
+import io.fabric8.kubernetes.api.model.extensions.Ingress;
+import io.fabric8.kubernetes.client.KubernetesClient;
+import io.fabric8.kubernetes.client.KubernetesClientException;
+import io.fabric8.kubernetes.client.Watcher;
+import org.onosproject.cluster.ClusterService;
+import org.onosproject.cluster.LeadershipService;
+import org.onosproject.cluster.NodeId;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
+import org.onosproject.k8snetworking.api.K8sIngressAdminService;
+import org.onosproject.k8snode.api.K8sApiConfigEvent;
+import org.onosproject.k8snode.api.K8sApiConfigListener;
+import org.onosproject.k8snode.api.K8sApiConfigService;
+import org.onosproject.mastership.MastershipService;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
+import org.slf4j.Logger;
+
+import java.util.Objects;
+import java.util.concurrent.ExecutorService;
+
+import static java.util.concurrent.Executors.newSingleThreadExecutor;
+import static org.onlab.util.Tools.groupedThreads;
+import static org.onosproject.k8snetworking.api.Constants.K8S_NETWORKING_APP_ID;
+import static org.onosproject.k8snetworking.util.K8sNetworkingUtil.k8sClient;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Kubernetes ingress watcher used for feeding ingress information.
+ */
+@Component(immediate = true)
+public class K8sIngressWatcher {
+
+    private final Logger log = getLogger(getClass());
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
+    protected CoreService coreService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
+    protected MastershipService mastershipService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
+    protected ClusterService clusterService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
+    protected LeadershipService leadershipService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
+    protected K8sIngressAdminService k8sIngressAdminService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY)
+    protected K8sApiConfigService k8sApiConfigService;
+
+    private final ExecutorService eventExecutor = newSingleThreadExecutor(
+            groupedThreads(this.getClass().getSimpleName(), "event-handler"));
+
+    private final Watcher<Ingress> internalK8sIngressWatcher =
+            new InternalK8sIngressWatcher();
+    private final InternalK8sApiConfigListener internalK8sApiConfigListener =
+            new InternalK8sApiConfigListener();
+
+    private ApplicationId appId;
+    private NodeId localNodeId;
+
+    @Activate
+    protected void activate() {
+        appId = coreService.registerApplication(K8S_NETWORKING_APP_ID);
+        localNodeId = clusterService.getLocalNode().id();
+        leadershipService.runForLeadership(appId.name());
+        k8sApiConfigService.addListener(internalK8sApiConfigListener);
+
+        log.info("Started");
+    }
+
+    @Deactivate
+    protected void deactivate() {
+        k8sApiConfigService.removeListener(internalK8sApiConfigListener);
+        leadershipService.withdraw(appId.name());
+        eventExecutor.shutdown();
+
+        log.info("Stopped");
+    }
+
+    private class InternalK8sApiConfigListener implements K8sApiConfigListener {
+
+        private boolean isRelevantHelper() {
+            return Objects.equals(localNodeId, leadershipService.getLeader(appId.name()));
+        }
+
+        @Override
+        public void event(K8sApiConfigEvent event) {
+
+            switch (event.type()) {
+                case K8S_API_CONFIG_UPDATED:
+                    eventExecutor.execute(this::processConfigUpdating);
+                    break;
+                case K8S_API_CONFIG_CREATED:
+                case K8S_API_CONFIG_REMOVED:
+                default:
+                    // do nothing
+                    break;
+            }
+        }
+
+        private void processConfigUpdating() {
+            if (!isRelevantHelper()) {
+                return;
+            }
+
+            KubernetesClient client = k8sClient(k8sApiConfigService);
+
+            if (client != null) {
+                client.extensions().ingresses().watch(internalK8sIngressWatcher);
+            }
+        }
+    }
+
+    private class InternalK8sIngressWatcher implements Watcher<Ingress> {
+
+        @Override
+        public void eventReceived(Action action, Ingress ingress) {
+            switch (action) {
+                case ADDED:
+                    eventExecutor.execute(() -> processAddition(ingress));
+                    break;
+                case MODIFIED:
+                    eventExecutor.execute(() -> processModification(ingress));
+                    break;
+                case DELETED:
+                    eventExecutor.execute(() -> processDeletion(ingress));
+                    break;
+                case ERROR:
+                    log.warn("Failures processing ingress manipulation.");
+                default:
+                    break;
+            }
+        }
+
+        @Override
+        public void onClose(KubernetesClientException e) {
+            log.info("Ingress watcher OnClose: {}" + e);
+        }
+
+        private void processAddition(Ingress ingress) {
+            if (!isMaster()) {
+                return;
+            }
+
+            log.trace("Process ingress {} creating event from API server.",
+                    ingress.getMetadata().getName());
+
+            k8sIngressAdminService.createIngress(ingress);
+        }
+
+        private void processModification(Ingress ingress) {
+            if (!isMaster()) {
+                return;
+            }
+
+            log.trace("Process ingress {} updating event from API server.",
+                    ingress.getMetadata().getName());
+
+            if (k8sIngressAdminService.ingress(ingress.getMetadata().getUid()) != null) {
+                k8sIngressAdminService.updateIngress(ingress);
+            }
+        }
+
+        private void processDeletion(Ingress ingress) {
+            if (!isMaster()) {
+                return;
+            }
+
+            log.trace("Process ingress {} removal event from API server.",
+                    ingress.getMetadata().getName());
+
+            k8sIngressAdminService.removeIngress(ingress.getMetadata().getUid());
+        }
+
+        private boolean isMaster() {
+            return Objects.equals(localNodeId, leadershipService.getLeader(appId.name()));
+        }
+    }
+}
diff --git a/apps/k8s-networking/app/src/test/java/org/onosproject/k8snetworking/impl/K8sIngressManagerTest.java b/apps/k8s-networking/app/src/test/java/org/onosproject/k8snetworking/impl/K8sIngressManagerTest.java
new file mode 100644
index 0000000..f401207
--- /dev/null
+++ b/apps/k8s-networking/app/src/test/java/org/onosproject/k8snetworking/impl/K8sIngressManagerTest.java
@@ -0,0 +1,218 @@
+/*
+ * Copyright 2019-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.k8snetworking.impl;
+
+import com.google.common.collect.Lists;
+import com.google.common.util.concurrent.MoreExecutors;
+import io.fabric8.kubernetes.api.model.ObjectMeta;
+import io.fabric8.kubernetes.api.model.extensions.Ingress;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onlab.junit.TestUtils;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreServiceAdapter;
+import org.onosproject.core.DefaultApplicationId;
+import org.onosproject.event.Event;
+import org.onosproject.k8snetworking.api.K8sIngressEvent;
+import org.onosproject.k8snetworking.api.K8sIngressListener;
+import org.onosproject.store.service.TestStorageService;
+
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.onosproject.k8snetworking.api.K8sIngressEvent.Type.K8S_INGRESS_CREATED;
+import static org.onosproject.k8snetworking.api.K8sIngressEvent.Type.K8S_INGRESS_REMOVED;
+import static org.onosproject.k8snetworking.api.K8sIngressEvent.Type.K8S_INGRESS_UPDATED;
+
+/**
+ * Unit tests for kubernetes ingress manager.
+ */
+public class K8sIngressManagerTest {
+
+    private static final ApplicationId TEST_APP_ID = new DefaultApplicationId(1, "test");
+
+    private static final String UNKNOWN_UID = "unknown_uid";
+    private static final String UPDATED_UID = "updated_uid";
+    private static final String UPDATED_NAME = "updated_name";
+
+    private static final String INGRESS_UID = "ingress_uid";
+    private static final String INGRESS_NAME = "ingress_name";
+
+    private static final Ingress INGRESS = createK8sIngress(INGRESS_UID, INGRESS_NAME);
+    private static final Ingress INGRESS_UPDATED = createK8sIngress(INGRESS_UID, UPDATED_NAME);
+
+    private final TestK8sIngressListener testListener = new TestK8sIngressListener();
+
+    private K8sIngressManager target;
+    private DistributedK8sIngressStore k8sIngressStore;
+
+    @Before
+    public void setUp() throws Exception {
+        k8sIngressStore = new DistributedK8sIngressStore();
+        TestUtils.setField(k8sIngressStore, "coreService", new TestCoreService());
+        TestUtils.setField(k8sIngressStore, "storageService", new TestStorageService());
+        TestUtils.setField(k8sIngressStore, "eventExecutor", MoreExecutors.newDirectExecutorService());
+        k8sIngressStore.activate();
+
+        target = new K8sIngressManager();
+        TestUtils.setField(target, "coreService", new TestCoreService());
+        target.k8sIngressStore = k8sIngressStore;
+        target.addListener(testListener);
+        target.activate();
+    }
+
+    @After
+    public void tearDown() {
+        target.removeListener(testListener);
+        k8sIngressStore.deactivate();
+        target.deactivate();
+        k8sIngressStore = null;
+        target = null;
+    }
+
+    /**
+     * Tests if getting all ingresses return correct set of ingresses.
+     */
+    @Test
+    public void testGetIngresses() {
+        createBasicIngresses();
+        assertEquals("Number of ingresses did not match", 1, target.ingresses().size());
+    }
+
+    /**
+     * Tests if getting an ingress with UID returns the correct ingress.
+     */
+    @Test
+    public void testGetIngressByUid() {
+        createBasicIngresses();
+        assertNotNull("Ingress did not match", target.ingress(INGRESS_UID));
+        assertNull("Ingress did not match", target.ingress(UNKNOWN_UID));
+    }
+
+    /**
+     * Tests creating and removing a ingress, and checks if it triggers proper events.
+     */
+    @Test
+    public void testCreateAndRemoveIngress() {
+        target.createIngress(INGRESS);
+        assertEquals("Number of ingresses did not match", 1, target.ingresses().size());
+        assertNotNull("Ingress was not created", target.ingress(INGRESS_UID));
+
+        target.removeIngress(INGRESS_UID);
+        assertEquals("Number of ingresses did not match", 0, target.ingresses().size());
+        assertNull("Ingress was not removed", target.ingress(INGRESS_UID));
+
+        validateEvents(K8S_INGRESS_CREATED, K8S_INGRESS_REMOVED);
+    }
+
+    /**
+     * Tests updating a ingress, and checks if it triggers proper events.
+     */
+    @Test
+    public void testCreateAndUpdateIngress() {
+        target.createIngress(INGRESS);
+        assertEquals("Number of ingresses did not match", 1, target.ingresses().size());
+        assertEquals("Ingress did not match", INGRESS_NAME,
+                target.ingress(INGRESS_UID).getMetadata().getName());
+
+        target.updateIngress(INGRESS_UPDATED);
+
+        assertEquals("Number of ingresses did not match", 1, target.ingresses().size());
+        assertEquals("Ingress did not match", UPDATED_NAME,
+                target.ingress(INGRESS_UID).getMetadata().getName());
+        validateEvents(K8S_INGRESS_CREATED, K8S_INGRESS_UPDATED);
+    }
+
+    /**
+     * Tests if creating a null ingress fails with an exception.
+     */
+    @Test(expected = NullPointerException.class)
+    public void testCreateNullIngress() {
+        target.createIngress(null);
+    }
+
+    /**
+     * Tests if creating a duplicate ingress fails with an exception.
+     */
+    @Test(expected = IllegalArgumentException.class)
+    public void testCreateDuplicateIngress() {
+        target.createIngress(INGRESS);
+        target.createIngress(INGRESS);
+    }
+
+    /**
+     * Tests if removing ingress with null ID fails with an exception.
+     */
+    @Test(expected = IllegalArgumentException.class)
+    public void testRemoveIngressWithNull() {
+        target.removeIngress(null);
+    }
+
+    /**
+     * Tests if updating an unregistered ingress fails with an exception.
+     */
+    @Test(expected = IllegalArgumentException.class)
+    public void testUpdateUnregisteredIngress() {
+        target.updateIngress(INGRESS);
+    }
+
+    private void createBasicIngresses() {
+        target.createIngress(INGRESS);
+    }
+
+    private static Ingress createK8sIngress(String uid, String name) {
+        ObjectMeta meta = new ObjectMeta();
+        meta.setUid(uid);
+        meta.setName(name);
+
+        Ingress ingress = new Ingress();
+        ingress.setApiVersion("v1");
+        ingress.setKind("Ingress");
+        ingress.setMetadata(meta);
+
+        return ingress;
+    }
+
+    private static class TestCoreService extends CoreServiceAdapter {
+
+        @Override
+        public ApplicationId registerApplication(String name) {
+            return TEST_APP_ID;
+        }
+    }
+
+    private static class TestK8sIngressListener implements K8sIngressListener {
+        private List<K8sIngressEvent> events = Lists.newArrayList();
+
+        @Override
+        public void event(K8sIngressEvent event) {
+            events.add(event);
+        }
+    }
+
+    private void validateEvents(Enum... types) {
+        int i = 0;
+        assertEquals("Number of events did not match", types.length, testListener.events.size());
+        for (Event event : testListener.events) {
+            assertEquals("Incorrect event received", types[i], event.type());
+            i++;
+        }
+        testListener.events.clear();
+    }
+}
