Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Implementa una aplicación en Knative serving
Obtén más información sobre cómo usar la consola de Google Cloud para implementar un contenedor de muestra ya compilado para que se ejecute como servicio de Knative serving.
Sugerencia: Consulta el instructivo de GKE Enterprise para obtener detalles sobre la ruta de acceso más corta para configurar un entorno de GKE Enterprise que incluya un clúster de GKE y Cloud Service Mesh.
Implementa un contenedor de muestra
Usa la consola de Google Cloud para implementar un contenedor de muestra y crear un servicio en el clúster:
En la consola de Google Cloud, ve a la página Knative serving.
Selecciona el proyecto de Google Cloud en el que reside el clúster de GKE.
En la lista de clústeres disponibles, haz clic en Iniciar sesión para conectarte.
Haz clic en Crear servicios para abrir el formulario Crear servicios:
Selecciona tu clúster en el menú desplegable de clústeres disponibles.
Deja default como el nombre del espacio de nombres en el que deseas que se ejecute tu servicio.
Ingresa el nombre de servicio que desees. Por ejemplo, hello.
Haz clic en Siguiente.
Selecciona Implementar una revisión desde una imagen de contenedor y, luego, hola en la lista Contenedores de demostración.
Haz clic en Siguiente.
Selecciona Externa en Conectividad para que puedas acceder a tu servicio desde la Web.
Haz clic en Crear para implementar la imagen hello en Knative serving y espera a que termine la implementación.
¡Felicitaciones! Acabas de implementar un servicio en un clúster habilitado para Knative serving.
Accede al servicio implementado
Ahora que el servicio está en ejecución, puedes enviarle solicitudes. En esta sección, si suponemos que el clúster usa el nombre predeterminado de la puerta de enlace de entrada, se usa el dominio de prueba predeterminado para demostrar cómo acceder al servicio y verificar que funcione:
En la consola de Google Cloud, ve a la página Knative serving.
Haz clic en el nombre de tu servicio nuevo de Knative serving para abrir la página Detalles del servicio. Por ejemplo, hola.
En la parte superior de la página, haz clic en la URL para acceder al servicio implementado a través de tu navegador web. Por ejemplo, si nombras a tu servicio hello, la URL es similar a la siguiente, pero incluye la dirección IP externa del clúster: http://hello.default.kuberun.11.111.11.111.nip.io
¡Felicitaciones! Tu servicio de Knative serving está activo y controla las solicitudes.
Realiza una limpieza
Puedes borrar el servicio de Knative serving para evitar que se generen costos por la ejecución de esos recursos.
Las siguientes consideraciones se aplican a la eliminación de un servicio:
Si borras un servicio, se borrarán todos los recursos relacionados con él, incluidas todas las revisiones de ese servicio, sin importar si entregan tráfico o no.
Borrar un servicio no quita de forma automática las imágenes de contenedor de Container Registry
Para borrar imágenes de contenedor que usan las revisiones borradas de Container Registry, consulta Borra imágenes.
Si borras un servicio con uno o más activadores de Eventarc, estos no se borran de forma automática. Para borrar los activadores, consulta Administra activadores.
Después de la eliminación, el servicio permanece visible en la consola de Google Cloud y en la interfaz de línea de comandos hasta que la eliminación se complete por completo. Sin embargo, no puedes actualizar el servicio.
La eliminación de un servicio es una acción permanente, es decir, no se puede deshacer ni restablecer.
Sin embargo, si después de borrar un servicio, implementas un servicio nuevo con el mismo nombre en la misma región, tendrá la misma URL de extremo.
Para borrar de forma permanente el servicio y todos sus recursos, sigue estos pasos:
En la consola de Google Cloud, ve a la página Knative serving.
En la lista de servicios, busca el servicio de Knative serving que creaste y haz clic en su casilla de verificación para seleccionarlo.
Haz clic en BORRAR.
¿Qué sigue?
Para obtener información sobre cómo compilar un contenedor desde el código fuente, enviar a Container Registry y, luego, implementar, consulta el siguiente vínculo:
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2024-09-02 (UTC)"],[],[],null,["# Quickstart: Deploy an application to Knative serving\n\nDeploy an application to Knative serving\n========================================\n\nLearn how to use the Google Cloud console to deploy a prebuilt sample\ncontainer to run as a Knative serving service.\n\nBefore you begin\n----------------\n\nYou must have access to the Google Cloud project and cluster\nwhere Knative serving is installed. For details, see\n[Knative serving fleet installation overview](/kubernetes-engine/enterprise/knative-serving/docs/install).\n\n**Tip** : See the [GKE Enterprise tutorial](/anthos/docs/tutorials/explore-anthos)\nfor details about the shortest path to setting up a GKE Enterprise environment\nthat includes a GKE cluster and Cloud Service Mesh.\n\nDeploying a sample container\n----------------------------\n\nUse the Google Cloud console to deploy a sample container and create a service\nin your cluster:\n\n1. In the Google Cloud console, go to the **Knative serving** page.\n\n [Go to Knative serving](https://console.cloud.google.com/projectselector2/kubernetes/run)\n2. Select the Google Cloud project in which your GKE cluster resides.\n\n3. In the list of available clusters, click **Login** to connect.\n\n4. Open the **Create service** form by clicking **Create service**.\n\n5. In the available clusters dropdown menu, select your cluster.\n\n6. Leave `default` as the name of the\n [namespace](https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/)\n where you want your service to run.\n\n7. Enter a service name of your choice. For example, `hello`.\n\n8. Click **Next**.\n\n9. Select **Deploy one revision from an existing container image** , then\n select **hello** from in the **Demo containers** list.\n\n10. Click **Next**.\n\n11. Select **External** under *Connectivity*, so that you can access your\n service from the web.\n\n12. Click **Create** to deploy the `hello` image to Knative serving\n and wait for the deployment to finish.\n\nCongratulations! You have just deployed a service to a\nKnative serving enabled cluster.\n\nAccessing your deployed service\n-------------------------------\n\nNow that you have a service running, you can send requests to it. In this\nsection, assuming that your cluster uses default name of the ingress gateway,\nthe default test domain is used to demonstrate how to access your\nservice and verify that it's working:\n\n1. In the Google Cloud console, go to the **Knative serving** page.\n\n [Go to Knative serving](https://console.cloud.google.com/kubernetes/run)\n2. Click the name of your new Knative serving service to open the\n **Service details** page. For example, **hello**.\n\n3. At the top of the page, click the **URL** to access your deployed service\n through your web browser. For example, if you named your service `hello`, the\n URL is similar to the following but includes your cluster's external IP\n address: `http://hello.default.kuberun.11.111.11.111.nip.io`\n\nCongratulations! Your Knative serving service is live and handling requests.\n\nClean up\n--------\n\nYou can delete the Knative serving service to avoid incurring costs from\nrunning those resources.\n\nThe following considerations apply to deleting a service:\n\n- Deleting a service deletes all resources related to this service, including all revisions of this service whether they are serving traffic or not.\n- Deleting a service does not automatically remove container images from Container Registry.\n To delete container images used by the deleted revisions from Container Registry,\n refer to [Deleting images](/container-registry/docs/managing#deleting_images).\n\n | **Caution:** Container Registry is deprecated. Effective March 18, 2025,\n | Container Registry is shut down, and writing images to Container Registry is unavailable. For\n | details on the deprecation and how to migrate to Artifact Registry, see\n | [Container Registry deprecation](/container-registry/docs/deprecations/container-registry-deprecation).\n- Deleting a service with one or more Eventarc triggers does not automatically\n delete these triggers. To delete the triggers refer to [Manage triggers](/eventarc/docs/managing-triggers#trigger-delete).\n\n- After deletion, the service remains visible in the Google Cloud console and in the command line interface\n until the deletion is fully complete. However, you cannot update the service.\n\n- Deleting a service is permanent: there is no undo or restore.\n However, if after deleting a service, you deploy a new service with the same\n name in the same region, it will have the same endpoint URL.\n\nTo permanently delete the service and all its resources:\n\n1. In the Google Cloud console, go to the **Knative serving** page.\n\n [Go to Knative serving](https://console.cloud.google.com/kubernetes/run)\n2. In the services list, locate the Knative serving service that you created\n and click its checkbox to select it.\n\n3. Click **DELETE**.\n\nWhat's next\n-----------\n\nTo learn how to build a container from code source, push to Container Registry,\nand then deploy, see:\n\n- [Building containers](/kubernetes-engine/enterprise/knative-serving/docs/building/containers)\n- [Deploying container images](/kubernetes-engine/enterprise/knative-serving/docs/deploying)\n\nTo learn more about how Knative serving works, see the\n[Architectural overview](/kubernetes-engine/enterprise/knative-serving/docs/architecture-overview)."]]