Access your Kubernetes Deployment over the Internet

Overview

Kubexpose: Access your Kubernetes Deployment over the Internet

Kubexpose makes it easy to access a Kubernetes Deployment over a public URL. It's a Kubernetes Operator backed by a Custom Resource Definition.

Kubexpose is an experimental project built using kubebuilder

Quick start

Any Kubernetes cluster will work (minikube, kind, Docker Desktop, on the cloud, whatever...). To deploy the operator and required components:

kubectl apply -f https://raw.githubusercontent.com/abhirockzz/kubexpose-operator/master/kubexpose-all-in-one.yaml

# check CRD
kubectl get crd

Make sure Operator is up and running:

export OPERATOR_NAMESPACE=kubexpose-operator-system

# check Pods
kubectl get pods -n $OPERATOR_NAMESPACE

# check logs
kubectl logs -f $(kubectl get pods --namespace $OPERATOR_NAMESPACE -o=jsonpath='{.items[0].metadata.name}') -c manager -n $OPERATOR_NAMESPACE

Create nginx Deployment (this is the one you want to expose over the internet using a public URL) and kubexpose resource (which will help you do that!):

kubectl apply -f https://raw.githubusercontent.com/abhirockzz/kubexpose-operator/master/quickstart/nginx.yaml

kubectl apply -f https://raw.githubusercontent.com/abhirockzz/kubexpose-operator/master/quickstart/kubexpose.yaml

Wait for a few seconds and check the public URL at which the Nginx Deployment can be accessed:

kubectl get kubexpose/kubexpose-test -o=jsonpath='{.status.url}'

Access the publlic URL using your browser or test it using curl

Confirm that the Service and Deployment have been created as well:

kubectl get svc/nginx-test-svc-kubexpose-test
kubectl get deployment/nginx-test-expose-kubexpose-test

You can try out other scenarios such as trying to Deployment and/or Service - the Operator will reconcile or bring things back to the state as specified in the resource.

To delete the kubexpose resource:

kubectl delete kubexpose/kubexpose-test

This will also delete the Service and Deployment which were created for this resource

Delete the Nginx deployment:

kubectl delete deployment/nginx-test

To uninstall the Operator:

kubectl delete -f https://raw.githubusercontent.com/abhirockzz/kubexpose-operator/master/kubexpose-all-in-one.yaml

This will delete the CRD, kubexpose operator and other resources.

How does it work?

Behind the scenes, Kubexpose uses the awesome ngrok project to get the job done! When you create a kubexpose resource, the operator:

  • Creates a ClusterIP type Service for the Deployment you want to access (naming format: <deployment name>-svc-<kubexpose resource name>)
  • Creates a Deployment (using this ngrok Docker image) that runs ngrok - which is configured to point to the Service (naming format: <deployment name>-expose-<kubexpose resource name>). It's equivalent to starting ngrok as such: ngrok http foo-svc-bar 80

The Deployment and Service and owned and managed by the Kubexpose resource instance.

Build from source

You need to have kubebuilder installed on your machine. If you don't want to do that, simply leverage the devcontainer config that comes with the project to setup the entire environment in just a few clicks.

Clone the repository:

git clone https://github.com/abhirockzz/kubexpose-operator

First, build a Docker image and push it to a registry of your choice:

export IMG=<enter docker image e.g. my-docker-repo/kubexpose>
docker login
make docker-build docker-push IMG=$IMG

You can now setup the operator and associated resources on the Kubernetes cluster:

export IMG=<enter docker image e.g. my-docker-repo/kubexpose>
make deploy IMG=$IMG

This single command will create a bunch of resources, such as the Kubexpose Custom Resource Definition (CRD), Kubexpose Operator Deployment, RBAC policies etc.

Check the output for details:

/workspaces/kubexpose-operator/bin/controller-gen "crd:trivialVersions=true,preserveUnknownFields=false" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
cd config/manager && /workspaces/kubexpose-operator/bin/kustomize edit set image controller=abhirockzz/kubexpose
/workspaces/kubexpose-operator/bin/kustomize build config/default | kubectl apply -f -
namespace/kubexpose-operator-system created
customresourcedefinition.apiextensions.k8s.io/kubexposes.kubexpose.kubexpose.io created
serviceaccount/kubexpose-operator-controller-manager created
role.rbac.authorization.k8s.io/kubexpose-operator-leader-election-role created
clusterrole.rbac.authorization.k8s.io/kubexpose-operator-manager-role created
clusterrole.rbac.authorization.k8s.io/kubexpose-operator-metrics-reader created
clusterrole.rbac.authorization.k8s.io/kubexpose-operator-proxy-role created
rolebinding.rbac.authorization.k8s.io/kubexpose-operator-leader-election-rolebinding created
clusterrolebinding.rbac.authorization.k8s.io/kubexpose-operator-manager-rolebinding created
clusterrolebinding.rbac.authorization.k8s.io/kubexpose-operator-proxy-rolebinding created
configmap/kubexpose-operator-manager-config created
service/kubexpose-operator-controller-manager-metrics-service created
deployment.apps/kubexpose-operator-controller-manager created

The operator runs in a different namespace - kubexpose-operator-system

To check the operator Deployment:

export OPERATOR_NAMESPACE=kubexpose-operator-system

# wait for Pod to come up
kubectl get pods -n $OPERATOR_NAMESPACE -w

# check logs
kubectl logs -f $(kubectl get pods --namespace $OPERATOR_NAMESPACE -o=jsonpath='{.items[0].metadata.name}') -c manager -n $OPERATOR_NAMESPACE
You might also like...
A Go based deployment tool that allows the users to deploy the web application on the server using SSH information and pem file.

A Go based deployment tool that allows the users to deploy the web application on the server using SSH information and pem file. This application is intend for non tecnhincal users they can just open the GUI and given the server details just deploy.

Secure Distributed Thanos Deployment using an Observability Cluster

Atlas Status: BETA - I don't expect breaking changes, but still possible. Atlas, forced by Zeus to support the heavens and the skies on his shoulders.

crud is a cobra based CLI utility which helps in scaffolding a simple go based micro-service along with build scripts, api documentation, micro-service documentation and k8s deployment manifests

crud crud is a CLI utility which helps in scaffolding a simple go based micro-service along with build scripts, api documentation, micro-service docum

expose controller, when deployment created service and ingress will be created

expose-controller expose controller, when deployment created service and ingress will be created How to test git clone repository cd expose-controller

Cdk-ecr-deployment - CDK Contruct for publishing ECR Images

cdk-ecr-deployment CDK construct to deploy docker image to Amazon ECR ⚠️ Please

Zdeploy - Deployment file tool with golang

zdeploy 中文 Deployment file tool Transfer deployment files Provide shell/bat exec

Linux provisioning scripts + application deployment tools. Suitable for self-hosting and hobby-scale application deployments.

Apollo Linux provisioning scripts + application deployment tools. Suitable for self-hosting and hobby-scale application deployments. Philosophy Linux-

PolarDB Stack is a DBaaS implementation for PolarDB-for-Postgres, as an operator creates and manages PolarDB/PostgreSQL clusters running in Kubernetes. It provides re-construct, failover swtich-over, scale up/out, high-available capabilities for each clusters.
PolarDB Stack is a DBaaS implementation for PolarDB-for-Postgres, as an operator creates and manages PolarDB/PostgreSQL clusters running in Kubernetes. It provides re-construct, failover swtich-over, scale up/out, high-available capabilities for each clusters.

PolarDB Stack开源版生命周期 1 系统概述 PolarDB是阿里云自研的云原生关系型数据库,采用了基于Shared-Storage的存储计算分离架构。数据库由传统的Share-Nothing,转变成了Shared-Storage架构。由原来的N份计算+N份存储,转变成了N份计算+1份存储

Owner
Abhishek Gupta
Azure Cosmos DB at Microsoft
Abhishek Gupta
Managing your Kubernetes clusters (including public, private, edge, etc) as easily as visiting the Internet

Clusternet Managing Your Clusters (including public, private, hybrid, edge, etc) as easily as Visiting the Internet. Clusternet (Cluster Internet) is

Clusternet 1.1k Dec 30, 2022
Kubernetes Operator for a Cloud-Native OpenVPN Deployment.

Meerkat is a Kubernetes Operator that facilitates the deployment of OpenVPN in a Kubernetes cluster. By leveraging Hashicorp Vault, Meerkat securely manages the underlying PKI.

Oliver Borchert 32 Jan 4, 2023
Simple CLI tool and Kubernetes deployment.

Simple Application A basic example of how to build a naml project. app.go Every project should define an app.go file. The file should implement the De

NAML Examples 11 Dec 21, 2022
Kubernetes workload controller for container image deployment

kube-image-deployer kube-image-deployer는 Docker Registry의 Image:Tag를 감시하는 Kubernetes Controller입니다. Keel과 유사하지만 단일 태그만 감시하며 더 간결하게 동작합니다. Container, I

PUBG Corporation 2 Mar 8, 2022
Pega-deploy - Pega deployment on Kubernetes

Pega deployment on Kubernetes This project provides Helm charts and basic exampl

Thomas Peters 1 Jan 30, 2022
Kubernetes Operator to automate Helm, DaemonSet, StatefulSet & Deployment updates

Keel - automated Kubernetes deployments for the rest of us Website https://keel.sh Slack - kubernetes.slack.com look for channel #keel Keel is a tool

Keel 2.1k Dec 28, 2022
Kubernetes OS Server - Kubernetes Extension API server exposing OS configuration like sysctl via Kubernetes API

KOSS is a Extension API Server which exposes OS properties and functionality using Kubernetes API, so it can be accessed using e.g. kubectl. At the moment this is highly experimental and only managing sysctl is supported. To make things actually usable, you must run KOSS binary as root on the machine you will be managing.

Mateusz Gozdek 3 May 19, 2021
Super simple deployment tool

Dropship Dropship is a simple tool for installing and updating artifacts from a CDN. Features Automatically performs md5sum checks of artifact that is

Christopher McKenzie 62 Oct 4, 2022
a build tool for Go, with a focus on cross-compiling, packaging and deployment

goxc NOTE: goxc has long been in maintenance mode. Ever since Go1.5 supported simple cross-compilation, this tool lost much of its value. There are st

Am Laher 1.7k Dec 9, 2022