» Upgrades
This topic describes how to upgrade Consul API Gateway.
» Breaking Changes
Consul API Gateway v0.2.0 introduces a breaking change for people upgrading from Consul API Gateway v0.1.0. Routes with a backendRef
defined in a different namespace now require a ReferencePolicy
that explicitly allows traffic from the route's namespace to the backendRef
's namespace.
» Requirements
Ensure that the following requirements are met prior to upgrading:
- Consul API Gateway should be running version v0.1.0.
- You should have the ability to run
kubectl
CLI commands. kubectl
should be configured to point to the cluster containing the installation you are upgrading.- You should have the following permission rights on your Kubernetes cluster:
- (Optional) The jq command line processor for JSON can be installed, which will ease route retrieval during the upgrade process.
» Procedure
NOTE When you see VERSION
in examples of commands or configuration settings, replace VERSION
with the version number of the release you are installing, like 0.2.0
. If there is a lower case "v" in front of VERSION
the version number needs to follow the "v" as is v0.2.0
Verify the current version of the
consul-api-gateway-controller
Deployment
:You should receive the following response:
Retrieve all routes that have a backend in a different namespace. If you have installed the
jq
utility, you can skip to step 4. Otherwise, issue the following command to get allHTTPRoutes
andTCPRoutes
across all namespaces:Note that the command only retrieves
HTTPRoutes
andTCPRoutes
.TLSRoutes
andUDPRoutes
are not supported in v0.1.0.If you have any active
HTTPRoutes
orTCPRoutes
, you will receive output similar to the following response. The output has been truncated to show only relevant fields:Inspect the
backendRefs
entries for each of the routes.If a
namespace
field is not defined in thebackendRef
or if the namespace matches the namespace of the route, then no additional action is required for thebackendRef
. Otherwise, note thegroup
,kind
,name
, andnamespace
field values forbackendRef
configurations that have anamespace
defined that do not match the namespace of the parent route. You must also note thekind
andnamespace
of the parent route. You will need these to create aReferencePolicy
that explicitly allows each cross-namespace route-to-service pair to prevent the route from breaking (see step 5).After completing this step, you will have a list of all routes similar to the following:
Skip to step 8 if your list is empty.
If you have installed
jq
, issue the following command to get allHTTPRoutes
andTCPRoutes
and filter for routes that require aReferencePolicy
.Note that the command retrieves all
HTTPRoutes
andTCPRoutes
.TLSRoutes
andUDPRoutes
are not supported in v0.1.0.The output will resemble the following response if routes that require a new
ReferencePolicy
are returned:If your output is empty, skip to step 8.
Using the list of routes you created earlier as a guide, create a
ReferencePolicy
to allow cross namespace traffic for each route service pair. TheReferencePolicy
explicitly allows each cross-namespace route to service pair to prevent the route from breaking. TheReferencePolicy
must be created in the samenamespace
as the backendService
.Skip to the next step if you've already created a
ReferencePolicy
.The following example
ReferencePolicy
enablesHTTPRoute
traffic from theexample-namespace
to Kubernetes Services in theweb-backend
namespace:referencepolicy.yamlIf you have already created a
ReferencePolicy
, modify it to allow your route and save it asreferencepolicy.yaml
. Note that eachReferencePolicy
only supports oneto
field and onefrom
field (refer theReferencePolicy
documentation). As a result, you may need to create multipleReferencePolicy
s.Issue the following command to apply it to your cluster:
Repeat this step as needed until each of your cross-namespace routes have a corresponding
ReferencePolicy
.Issue the following command to install the new version of CRDs into your cluster:
Update
apiGateway.image
invalues.yaml
:values.yamlIssue the following command to upgrade your Consul installation:
Note that the upgrade will cause the Consul API Gateway controller shut down and restart with the new version.
According to the Kubernetes Gateway API specification, Gateway Class configurations should only be applied to a gateway upon creation. To see the effects on preexisting gateways after upgrading your CRD installation, delete and recreate any gateways by issuing the following commands:
(Optional) Delete and recreate your routes. Note that it may take several minutes for attached routes to reconcile and start reporting bind errors.
» Post-Upgrade Configuration Changes
No additional configuration changes are required for this upgrade.