Categories
Articles

How to deploy .NET apps to Docker to Kubernetes

1. Install docker on Ubuntu

source 1

  1. sudo apt-get update
  2. sudo apt-get upgrade
  3. follow these steps
  4. sudo systemctl start docker.service
  5. sudo systemctl enable docker.service
  6. sudo docker version
  7. Run docker without sudo: sudo usermod -aG docker [USER]
  8. After 7 you need: reboot
  9. docker search [name] -> thats for searching, example docker search nginx
  10. docker run hello-world
2. Install Kubernetes on ubuntu

Follow these steps. Important: before the command “sudo apt install kubeadm kubelet kubectl” run again “sudo apt-get update”

Nick Chapsas: How to deploy .NET apps to Kubernetes
  1. Create .NET project on VS
  2. Right click project -> Add… -> Docker support -> Linux
  3. Move Dockerfile out of project
  4. docker build -t johndoe/testapi:1.0.0 .
    explain1: <dockerhubusername>/<dockerhubrepo>:version
    explain2: . is the location of the folder
  5. docker push johndoe/testapi:1.0.0
  6. Then you go to Kubernetes and select the public or private DockerHub Repo and it works

Other sources:

How to Host .NET Core Applications in VPS Using Docker: Link

Run Docker Containers in Oracle Cloud free: Link