Standard way to put container images on a Kubernetes instance? - kubernetes

I've already read through Kubernetes tutorials. The problem is the lack of a straight answer on how to get a Kubernetes image for TeamCity into a plain Kubernetes instance.
My install doesn't use Google Cloud engine, Amazon EC2, or Azure, which means I can't use their built-in container registries.
This site appears to recommend installing docker and using it the pull the container image:
https://hub.docker.com/r/jetbrains/teamcity-server/
This GitHub page appears to imply that a specific plugin is required for kubernetes:
https://github.com/JetBrains/teamcity-kubernetes-plugin
The Rancher Web UI has a JavaScript/HTML form to install containerized apps: "Enter the URL of a public image on any registry, or a private image hosted on Docker Hub or Google Container Registry."
-> I found teamcity-server on Docker Hub, although I have no idea if I can just give it the page (https://hub.docker.com/r/jetbrains/teamcity-server/) or if there's a special subpath that I have to give it.

For the Docker Hub, the "Enter the URL" instructions are wrong and actually fail with an error. To use the Docker hub, you just type the repository name.
For example, to use teamcity-server:
https://hub.docker.com/r/jetbrains/teamcity-server/
you would type (as the app URL):
jetbrains/teamcity-server

Related

How to edit the Caddyfile with ECR

I am working with two containers, one is for Caddy and one is for my application, both of them have been hosted on ECS Fargate, while my application is being pulled from ECR and the caddy image is being pulled from the official Docker repository. Both the containers are running fine but I am not sure how to access the Caddyfile for Caddy to serve SSL certificates to my application. I am able to get the standard Caddy webpage on container, but I need to somehow edit the Caddyfile for my use-case, could someone help me out?
enter image description here
According to the documentation for the Caddy image you are using, you should be mounting a /data folder and a /config folder. To do that with ECS on Fargate you need to create an Amazon Elastic File System, and then configure those mount points in your ECS task definition to use the EFS.
If you just want to specify the domain name, the documentation says you can simply pass a --domain parameter in the caddy command line. You would do that by editing the command in your ECS task definition.
I think you will have to configure more than that in order to get it to proxy requests to your other container though.
If you want to bundle your config file into the docker image that is being deployed, the documentation I linked also describes how you can create your own version of the image. You would do that locally, push the image to ECR, and then configure your ECS task definition to use that image instead of the standard Docker Hub image.

How do I update a service in the cluster to use a new docker image

I have created a new docker image that I want to use to replace the current docker image. The application is on the kubernetes engine on google cloud platform.
I believe I am supposed to use the gcloud container clusters update command. Although, I struggle to see how it works and how I'm supposed to replace the old docker image with the new one.
You may want to use kubectl in order to interact with your GKE cluster. Method of image update depends on how the Pod / Container was created.
For some example commands, see https://kubernetes.io/docs/reference/kubectl/cheatsheet/#updating-resources
For example, kubectl set image deployment/frontend www=image:v2 will do a rolling update "www" containers of "frontend" deployment, updating the image.
Getting up and running on GKE: https://cloud.google.com/kubernetes-engine/docs/quickstart
You can use Container Registry[1] as a single place to manage Docker images.
Google Container Registry provides secure, private Docker repository storage on Google Cloud Platform. You can use gcloud to push[2] images to your registry, then you can pull images using an HTTP endpoint from any machine.
You can also use Docker Hub repositories[3] allow you share container images with your team, customers, or the Docker community at large.
[1]https://cloud.google.com/container-registry/
[2]https://cloud.google.com/container-registry/docs/pushing-and-pulling
[3]https://docs.docker.com/docker-hub/repos/

How to get flink streaming jar to kubernetes

With maven am building a fat jar for my streaming app. Have to deploy the jar to a k8 cluster. Enterprise don't have internal docker hub. So my option is to build the image as part of jenkins and use the same in kub job manager config. I would appreciate if any example demonstrating the project layout and steps to deploy
Used the build.sh script from https://github.com/apache/flink/blob/release-1.7/flink-container/docker/README.md and able to convert to docker image. And using docker compose am able to get the app running. But when trying for kub as specified in https://github.com/apache/flink/blob/release-1.7/flink-container/kubernetes/README.md#deploy-flink-job-cluster am seeing image not found.
Kubernetes does not manage images, it relies on Docker for that. You can check the Docker documentation About images, containers, and storage drivers.
In Kubernetes You can use the following registries: Google Container Registry, AWS EC2 Container Registry, Azure Container Registry, IBM Cloud Container Registry and your own Private Registry
You can read the Kubernetes documentation on how to Pull an Image from a Private Registry
You can find many projects helping with the setup of your own private registry.
One of the easiest ones is the project k8s-local-docker-registry by SeldonIO.
Start/Stop private registry in cluster
start private registry
./start-docker-private-registry
stop private registry
./stop-docker-private-registry
Check if the registry catalog can be accessed and the ability to push an image.
(set -x && curl -X GET http://127.0.0.1:5000/v2/_catalog && docker pull busybox && docker tag busybox 127.0.0.1:5000/busybox && docker push 127.0.0.1:5000/busybox)

Can a Service Fabric Container project pull from Docker Hub?

I have created a new Service Fabric Container project in Visual Studio that I am trying to test by publishing to the local cluster. I have created a Windows Container image that I have run locally in Docker. I pushed the image to a private registry in Docker Hub.
When I publish the project to the local cluster, it deploys, but then I get an error:
Error event: SourceId='System.Hosting', Property='Download:1.0:1.0'.
There was an error during download.Failed to download container image docker.io/(username)/(repository)
All the examples show pulling an image from Azure Container Registry. Does Service Fabric only work with ACR, or do I have to add additional configuration to my service manifest to use a private Docker Hub registry?
Edit: also, it seems unable to find the container locally. I tried using the tagged local name of the image from the local repository (I checked using "docker images" and it is there). Same result. Service Fabric should be able to find it:
Service Fabric will pull down the image (if it's not already in the local registry) and launch a container based on the arguments you provide.
from MSDN blog on Service Fabric
It looks like the problem is that Service Fabric does not support container deployment on Windows 10 (and my dev machine is Win10, so local development/testing is out). There are notes to this effect on the Azure Documentation but I guess I didn't notice them or glossed over them...

Jenkins plugin to deploy a docker image into a k8s cluster?

I have been looking for a jenkins plugin to deploy a docker image to a kubernetes cluster using k8s api. This will access the rest api with yaml file with credentials that already configured. If there is no similar plugin, you can let me know other simple examples. Thanks for reading.
I think you are looking for a plugin's which is similar to this
https://wiki.jenkins-ci.org/display/JENKINS/Kubernetes+CI+Plugin
https://wiki.jenkins.io/display/JENKINS/Kubernetes+Pipeline+Plugin
I'm using a simple Execute Shellstep in Jenkins with the fallowing command:
kubectl --server="https://kubeapi.example.com" --token=$ACCESS_TOKEN set image deployment/deployment_name container_name=repo/image:"$BUILD_NUMBER-$SHORT_GIT_COMMIT"
You can save your $ACCESS_TOKENas a Secret text and use it as a variable in Jenkins.
The job is making the build, tag and publish a docker image to docker repo, then set the image in the kubernetes cluster.