github.com/projectcontour/contour@v1.28.2/site/content/getting-started/_index.md (about)

     1  ---
     2  title: Getting Started with Contour
     3  description: Getting Started with Contour
     4  id: getting-started
     5  ---
     6  
     7  # Getting Started with Contour
     8  
     9  This guide shows how to install Contour in three different ways:
    10  - using Contour's example YAML
    11  - using the Helm chart for Contour
    12  - using the Contour gateway provisioner (beta)
    13  
    14  It then shows how to deploy a sample workload and route traffic to it via Contour.
    15  
    16  This guide uses all default settings. No additional configuration is required.
    17  
    18  ## Validate Kubernetes environment
    19  
    20  This guide is designed to work with:
    21  
    22  - a Kubernetes cluster with support for services of type `LoadBalancer` (GKE, AKS, EKS, etc.); or
    23  - a locally-running [kind cluster][27] with port mappings configured
    24  
    25  If you already have access to one of these Kubernetes environments, you're ready to move on to installing Contour.
    26  If not, you can [set up a local kind cluster][28] for testing purposes.
    27   
    28  ## Install Contour and Envoy
    29  
    30  ### Option 1: YAML
    31  Run the following to install Contour:
    32  
    33  ```bash
    34  $ kubectl apply -f https://projectcontour.io/quickstart/contour.yaml
    35  ```
    36  
    37  Verify the Contour pods are ready by running the following: 
    38  
    39  ```bash
    40  $ kubectl get pods -n projectcontour -o wide
    41  ```
    42  
    43  You should see the following:
    44  - 2 Contour pods each with status **Running** and 1/1 **Ready**  
    45  - 1+ Envoy pod(s), each with the status **Running** and 2/2 **Ready**  
    46  
    47  ### Option 2: Helm
    48  This option requires [Helm to be installed locally][29].
    49  
    50  Add the bitnami chart repository (which contains the Contour chart) by running the following:  
    51  
    52  ```bash  
    53  $ helm repo add bitnami https://charts.bitnami.com/bitnami
    54  ```
    55  
    56  Install the Contour chart by running the following:
    57  
    58  ```bash 
    59  $ helm install my-release bitnami/contour --namespace projectcontour --create-namespace
    60  ```  
    61  
    62  Verify Contour is ready by running:
    63  
    64  ```bash
    65  $ kubectl -n projectcontour get po,svc
    66  ```  
    67  
    68  You should see the following:
    69  - 1 instance of pod/my-release-contour-contour with status **Running** and 1/1 **Ready**  
    70  - 1+ instance(s) of pod/my-release-contour-envoy with each status **Running** and 2/2 **Ready**  
    71  - 1 instance of service/my-release-contour 
    72  - 1 instance of service/my-release-contour-envoy
    73  
    74  
    75  ### Option 3: Contour Gateway Provisioner (beta)
    76  
    77  The Gateway provisioner watches for the creation of [Gateway API][31] `Gateway` resources, and dynamically provisions Contour+Envoy instances based on the `Gateway's` spec.
    78  Note that although the provisioning request itself is made via a Gateway API resource (`Gateway`), this method of installation still allows you to use *any* of the supported APIs for defining virtual hosts and routes: `Ingress`, `HTTPProxy`, or Gateway API's `HTTPRoute` and `TLSRoute`.
    79  In fact, this guide will use an `Ingress` resource to define routing rules, even when using the Gateway provisioner for installation.
    80  
    81  
    82  Deploy the Gateway provisioner:
    83  ```bash
    84  $ kubectl apply -f https://projectcontour.io/quickstart/contour-gateway-provisioner.yaml
    85  ```
    86  
    87  Verify the Gateway provisioner deployment is available:
    88  
    89  ```bash
    90  $ kubectl -n projectcontour get deployments
    91  NAME                          READY   UP-TO-DATE   AVAILABLE   AGE
    92  contour-gateway-provisioner   1/1     1            1           1m
    93  ```
    94  
    95  Create a GatewayClass:
    96  
    97  ```shell
    98  kubectl apply -f - <<EOF
    99  kind: GatewayClass
   100  apiVersion: gateway.networking.k8s.io/v1
   101  metadata:
   102    name: contour
   103  spec:
   104    controllerName: projectcontour.io/gateway-controller
   105  EOF
   106  ```
   107  
   108  Create a Gateway:
   109  
   110  ```shell
   111  kubectl apply -f - <<EOF
   112  kind: Gateway
   113  apiVersion: gateway.networking.k8s.io/v1
   114  metadata:
   115    name: contour
   116    namespace: projectcontour
   117  spec:
   118    gatewayClassName: contour
   119    listeners:
   120      - name: http
   121        protocol: HTTP
   122        port: 80
   123        allowedRoutes:
   124          namespaces:
   125            from: All
   126  EOF
   127  ```
   128  
   129  Verify the `Gateway` is available (it may take up to a minute to become available):
   130  
   131  ```bash
   132  $ kubectl -n projectcontour get gateways
   133  NAME        CLASS     ADDRESS         READY   AGE
   134  contour     contour                   True    27s
   135  ```
   136  
   137  Verify the Contour pods are ready by running the following: 
   138  
   139  ```bash
   140  $ kubectl -n projectcontour get pods
   141  ```
   142  
   143  You should see the following:
   144  - 2 Contour pods each with status **Running** and 1/1 **Ready**  
   145  - 1+ Envoy pod(s), each with the status **Running** and 2/2 **Ready**  
   146  
   147  ## Test it out!
   148  
   149  Congratulations, you have installed Contour and Envoy! Let's install a web application workload and get some traffic flowing to the backend.
   150  
   151  To install [httpbin][9], run the following:
   152  
   153  ```bash
   154  kubectl apply -f https://projectcontour.io/examples/httpbin.yaml
   155  ```
   156  
   157  Verify the pods and service are ready by running:
   158  
   159  ```bash
   160  kubectl get po,svc,ing -l app=httpbin
   161  ```  
   162  
   163  You should see the following:
   164  - 3 instances of pods/httpbin, each with status **Running** and 1/1 **Ready**
   165  - 1 service/httpbin CLUSTER-IP listed on port 80
   166  - 1 Ingress on port 80
   167  
   168  **NOTE**: the Helm install configures Contour to filter Ingress and HTTPProxy objects based on the `contour` IngressClass name.
   169  If using Helm, ensure the Ingress has an ingress class of `contour` with the following:
   170  
   171  ```bash
   172  kubectl patch ingress httpbin -p '{"spec":{"ingressClassName": "contour"}}'
   173  ```
   174  
   175  Now we're ready to send some traffic to our sample application, via Contour & Envoy.
   176  
   177  _Note, for simplicity and compatibility across all platforms we'll use `kubectl port-forward` to get traffic to Envoy, but in a production environment you would typically use the Envoy service's address._
   178  
   179  Port-forward from your local machine to the Envoy service:
   180  ```shell
   181  # If using YAML
   182  $ kubectl -n projectcontour port-forward service/envoy 8888:80
   183  
   184  # If using Helm
   185  $ kubectl -n projectcontour port-forward service/my-release-contour-envoy 8888:80
   186  
   187  # If using the Gateway provisioner
   188  $ kubectl -n projectcontour port-forward service/envoy-contour 8888:80
   189  ```
   190  
   191  In a browser or via `curl`, make a request to http://local.projectcontour.io:8888 (note, `local.projectcontour.io` is a public DNS record resolving to 127.0.0.1 to make use of the forwarded port).
   192  You should see the `httpbin` home page.
   193  
   194  Congratulations, you have installed Contour, deployed a backend application, created an `Ingress` to route traffic to the application, and successfully accessed the app with Contour!
   195  
   196  ## Next Steps  
   197  Now that you have a basic Contour installation, where to go from here?
   198  
   199  - Explore [HTTPProxy][2], a cluster-wide reverse proxy
   200  - Explore the [Gateway API documentation][32] and [Gateway API guide][14]
   201  - Explore other [deployment options][1]
   202  
   203  Check out the following demo videos:
   204  - [Contour 101 - Kubernetes Ingress and Blue/Green Deployments][20]
   205  - [HTTPProxy in Action][19]  
   206  - [Contour Demos and Deep Dives videos][21]
   207  
   208  Explore the documentation:  
   209  - [FAQ][4]
   210  - [Contour Architecture][18]
   211  - [Contour Configuration Reference][7]
   212    
   213  ## Connect with the Team
   214  Have questions? Send a Slack message on the Contour channel, an email on the mailing list, or join a Contour meeting.
   215  - Slack: kubernetes.slack.com [#contour][12]
   216  - Join us in a [User Group][10] or [Office Hours][11] meeting 
   217  - Join the [mailing list][25] for the latest information
   218  
   219  ## Troubleshooting
   220  
   221  If you encounter issues, review the [troubleshooting][17] page, [file an issue][6], or talk to us on the [#contour channel][12] on Kubernetes Slack.
   222  
   223  [1]: /docs/{{< param latest_version >}}/deploy-options
   224  [2]: /docs/{{< param latest_version >}}/config/fundamentals
   225  [3]: /docs/{{< param latest_version >}}
   226  [4]: {{< ref "resources/faq.md" >}}
   227  [6]: {{< param github_url >}}/issues
   228  [7]: /docs/{{< param latest_version >}}/configuration/
   229  [9]: https://httpbin.org/
   230  [10]: {{< relref "community.md" >}}
   231  [11]: https://github.com/projectcontour/community/wiki/Office-Hours
   232  [12]: {{< param slack_url >}}
   233  [13]: https://projectcontour.io/resources/deprecation-policy/
   234  [14]: /docs/{{< param latest_version >}}/guides/gateway-api
   235  [15]: https://github.com/bitnami/charts/tree/master/bitnami/contour
   236  [16]: https://github.com/helm/charts#%EF%B8%8F-deprecation-and-archive-notice
   237  [17]: /docs/{{< param latest_version >}}/troubleshooting
   238  [18]: /docs/{{< param latest_version >}}/architecture
   239  [19]: https://youtu.be/YA82A4Rcs_A
   240  [20]: https://www.youtube.com/watch?v=xUJbTnN3Dmw
   241  [21]: https://www.youtube.com/playlist?list=PL7bmigfV0EqRTmmjwWm4SxuCZwNvze7se
   242  [22]: https://kind.sigs.k8s.io/docs/user/quick-start/
   243  [23]: https://docs.docker.com/desktop/#download-and-install
   244  [25]: https://lists.cncf.io/g/cncf-contour-users/
   245  [26]: https://www.envoyproxy.io/
   246  [27]: https://kind.sigs.k8s.io/
   247  [28]: /docs/{{< param latest_version >}}/guides/kind
   248  [29]: https://helm.sh/docs/intro/install/
   249  [30]: /docs/{{< param latest_version >}}/guides/kind/#kind-configuration-file
   250  [31]: https://gateway-api.sigs.k8s.io/
   251  [32]: /docs/{{< param latest_version >}}/config/gateway-api